logical path to current dir lost during login

Andreas Amann amann at physik.tu-berlin.de
Wed Nov 15 06:32:13 EST 2000


Hello,

I use openssh-2.3.0p1 under linux-2.2.16 with standard settings and
experience the following annoying problem: After I login the current
directory is not set to the $HOME directory as expected, but to the
_resolved_ path-name of the $HOME directory, where links and
automounter dirs are expanded. To be specific, my $HOME is
"/home/amann" but since /home is a link to the automounter directory
/net/hservnlds/home/, my current working directory after login is
"/tmp_mnt/hservnlds/home/amann". The reason for this is that sshd does
not set the $PWD variable correctly.

In order to fix this bug, I propose the following patch:

diff -u ../../sb/openssh-2.3.0p1/session.c ./session.c
--- ../../sb/openssh-2.3.0p1/session.c  Sat Oct 28 05:19:58 2000
+++ ./session.c Tue Nov 14 16:07:54 2000
@@ -1293,6 +1293,8 @@
                if (login_getcapbool(lc, "requirehome", 0))
                        exit(1);
 #endif
+       } else {
+               child_set_env(&env, &envsize, "PWD", pw->pw_dir);
        }

        /*
 


Disclaimer: This patch fixes the problem for me. Since I am not at all
familiar with security-critical programming, please check twice
before you apply this patch. It might also be considered to set $PWD
already before $HOME/.ssh/environment is read. 
(BTW, why is there no global /etc/environment file, I really miss it).



CU,

Andreas





More information about the openssh-unix-dev mailing list