Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
strange problem with ssh and .bashrc
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Dragonlord
Guru
Guru


Joined: 22 Aug 2004
Posts: 446
Location: Switzerland

PostPosted: Sun Sep 26, 2004 12:20 am    Post subject: strange problem with ssh and .bashrc Reply with quote

usually if you login through ssh the .bashrc should be executed and so far on the old machien it did.

now on the new system on the other hand the ssh does not want to execute anything from my home. nor the .bashrc, .bash_profile, .bash_login or whatever startup script i place there, nothing gets executed if i login through ssh.

anybody has an idea how i get that back? it sux to do 'source ~/,bashrc' all time you login.
_________________
DragonDreams: Leader and Head Programmer
Back to top
View user's profile Send private message
ixion
l33t
l33t


Joined: 16 Dec 2002
Posts: 708

PostPosted: Tue Feb 01, 2005 12:44 pm    Post subject: Reply with quote

I'm having this same problem! Were you able to resolve this? If not, why is this such a mystery to everyone?
_________________
only the paranoid survive
Back to top
View user's profile Send private message
ixion
l33t
l33t


Joined: 16 Dec 2002
Posts: 708

PostPosted: Fri Feb 04, 2005 3:18 pm    Post subject: Reply with quote

nothing?
_________________
only the paranoid survive
Back to top
View user's profile Send private message
t3rm1nal
Apprentice
Apprentice


Joined: 17 May 2004
Posts: 173
Location: US

PostPosted: Fri Feb 04, 2005 8:45 pm    Post subject: Reply with quote

yeah, ran into the same thing today...this looks relevant, however im unable to work on this problem right now (at work) maybe in one of these files? from the bash man page...

Quote:

INVOCATION
A login shell is one whose first character of argument zero is a -, or one started with the --login option.

An interactive shell is one started without non-option arguments and without the -c option whose standard input and output
are both connected to terminals (as determined by isatty(3)), or one started with the -i option. PS1 is set and $-
includes i if bash is interactive, allowing a shell script or a startup file to test this state.

The following paragraphs describe how bash executes its startup files. If any of the files exist but cannot be read, bash
reports an error. Tildes are expanded in file names as described below under Tilde Expansion in the EXPANSION section.

When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads
and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_pro-
file, ~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is
readable. The --noprofile option may be used when the shell is started to inhibit this behavior.

When a login shell exits, bash reads and executes commands from the file ~/.bash_logout, if it exists.

When an interactive shell that is not a login shell is started, bash reads and executes commands from ~/.bashrc, if that
file exists. This may be inhibited by using the --norc option. The --rcfile file option will force bash to read and exe-
cute commands from file instead of ~/.bashrc.

When bash is started non-interactively, to run a shell script, for example, it looks for the variable BASH_ENV in the envi-
ronment, expands its value if it appears there, and uses the expanded value as the name of a file to read and execute.
Bash behaves as if the following command were executed:
if [ -n "$BASH_ENV" ]; then . "$BASH_ENV"; fi
but the value of the PATH variable is not used to search for the file name.

If bash is invoked with the name sh, it tries to mimic the startup behavior of historical versions of sh as closely as pos-
sible, while conforming to the POSIX standard as well. When invoked as an interactive login shell, or a non-interactive
shell with the --login option, it first attempts to read and execute commands from /etc/profile and ~/.profile, in that
order. The --noprofile option may be used to inhibit this behavior. When invoked as an interactive shell with the name
sh, bash looks for the variable ENV, expands its value if it is defined, and uses the expanded value as the name of a file
to read and execute. Since a shell invoked as sh does not attempt to read and execute commands from any other startup
files, the --rcfile option has no effect. A non-interactive shell invoked with the name sh does not attempt to read any
other startup files. When invoked as sh, bash enters posix mode after the startup files are read.

When bash is started in posix mode, as with the --posix command line option, it follows the POSIX standard for startup
files. In this mode, interactive shells expand the ENV variable and commands are read and executed from the file whose
name is the expanded value. No other startup files are read.

Bash attempts to determine when it is being run by the remote shell daemon, usually rshd. If bash determines it is being
run by rshd, it reads and executes commands from ~/.bashrc, if that file exists and is readable. It will not do this if
invoked as sh. The --norc option may be used to inhibit this behavior, and the --rcfile option may be used to force
another file to be read, but rshd does not generally invoke the shell with those options or allow them to be specified.

If the shell is started with the effective user (group) id not equal to the real user (group) id, and the -p option is not
supplied, no startup files are read, shell functions are not inherited from the environment, the SHELLOPTS variable, if it
appears in the environment, is ignored, and the effective user id is set to the real user id. If the -p option is supplied
at invocation, the startup behavior is the same, but the effective user id is not reset.

_________________

Adopt an unanswered post.
Back to top
View user's profile Send private message
ixion
l33t
l33t


Joined: 16 Dec 2002
Posts: 708

PostPosted: Mon Feb 07, 2005 6:45 pm    Post subject: Reply with quote

I'm rather embarrassed, but the reason this was happening to me is because the user(s) had /bin/sh as their shell... creating ~/.profile works.

I hope my shortcoming can help someone else, though. :roll: :oops: :lol: :D

cheers t3rm1nal!! :D :D :D
_________________
only the paranoid survive
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum