>From: "Dave Bender" <[EMAIL PROTECTED]>
>Date: Tue, 9 Oct 2001 14:25:28 -0500

>Where does the secure shell get its PATH information? I did this:
> [..cut..]
>The new path was the same as the old path. It didn't change. I stopped and
>restarted the ssh service but that didn't help either.
>
>Where does the ssh server get its path and how can I update it?

>From what is compiled in.  When you run configure to build OpenSSH one of the 
options is the default path:  ./configure --with-default-path=PATH
NOTE: this is the default unless something else changes it during execution.

Thus, you need to look in a few other places in case something is resetting it.  
The first thing to do is look at the way sshd handles specific requests.  Here 
is the general flow as stated in the OpenSSH sshd manpage.

1. If the login is on a tty, and no command has been specified, prints last 
   login time and /etc/motd (unless prevented in the configuration file or by 
   $HOME/.hushlogin)
2. If the login is on a tty, records login time.
3. Checks /etc/nologin; if it exists, prints contents and quits (unless root).
4. Changes to run with normal user privileges.
5. Sets up basic environment.
   NOTE: this will read /etc/environment on AIX machines
6. Reads $HOME/.ssh/environment if it exists.
   NOTE: puts all lines of form: VAR=VAL into environment.  It does NOT evaluate
         variables in the VAL part, thus: PATH=/usr/local/bin:$PATH literally 
         sets PATH equal to /usr/local/bin:$PATH which is definitely not what
         you want.
7. Changes to user's home directory.
8. If $HOME/.ssh/rc exists, runs it; else if /etc/sshrc exists, runs it; 
   otherwise runs xauth.  The ``rc'' files are given the X11 authentication 
   protocol and cookie in standard input.  
   NOTE: rc or sshrc run with /bin/sh
9. Runs user's shell or command.

Nine is important since the shell determins what happens next.  If it is a login 
(slogin), then your normal login proceeds and global settings may set things 
like your PATH environment variable.  Refer to your shell's documentation for 
which global files may be run.

If a command is run (ssh or scp), only a subshell is executed.  If it is 
csh/tcsh this means ~/.cshrc (or ~/.tcshrc) gets sourced BEFORE the command is 
executed.  For tcsh there is usually a global file (sometimes called 
/etc/csh.cshrc) that may also be sourced.  In sh (posix version) or ksh (or 
bash) if ENV is set when the shell starts then the file pointed to by that 
environment variable will also be sourced.  One trick an individual can do for 
ksh is set ENV in the environment file listed above.  Point it at a file that 
corrects for the mistakes in the installation, like fixing PATH, etc.  This can 
be a special file for ONLY sshd started shells, maybe ~/.kshrc_sshd.

Sorry for the length but there are many places you could be having a problem 
with this.  I figured describing what is being done would help you figure out 
where the problem may be.

        --Dave

--
David Knight French                           
Black Mountain Computer Consulting
Voice: (858)573-2959
Email: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to