On Sat, Aug 16, 2008 at 07:59:20PM -0700, Vagrant Cascadian wrote: > > cmd[i++] = ";"; > > + cmd[i++] = "exec"; > > + cmd[i++] = "sh"; > > cmd[i++] = "kill"; > > cmd[i++] = "-1"; > > cmd[i++] = "$PPID"; > > no probably about it, in my tests, it definitely solved the issue. > > because it uses exec, it gets the proper value for $PPID, which should > be the sshd process used to log in (yes, it's an ugly hack, but that's > how it works for now). at least on lenny. > > to reproduce: ssh to the server, with a user with the default shell of > tcsh. run "exec /bin/sh". "echo $PPID". the $PPID is the pid of sshd.
I did more test, and this works as you said: [EMAIL PROTECTED]:~$ ssh -l labtcsh oden 'exec /bin/sh' Password: echo $PPID 9741 However, I've tried various forms of this and I can't get to work: [EMAIL PROTECTED]:~$ ssh -l labtcsh oden 'exec /bin/sh -c echo \$PPID' Password: [EMAIL PROTECTED]:~$ ssh -l labtcsh oden 'exec /bin/sh -c echo $PPID' Password: PPID: Undefined variable. I also tried your complete dpatch as is and it does not solve the problem in my test setup, logouts fails and I need to kill the sshd process on the server in order for logout to complete. My only guess is that it has something to do with the above shell escaping issues. I have attached a dpatch formatted version of the method I used where PPID is retrieved using ps. So far this is the only method I've found that solves the problem together with an etch based server. Are you testing against a lenny server? > there's definitely resistance to applying any of these patches upstream: > > > http://sourceforge.net/mailarchive/forum.php?thread_name=20080815201358.GF12833%40ryukin.fglan&forum_name=ltsp-developer Sure, I can understand this. This tends to become a hot topic due to matter of preferences. I ended up a tcsh user since that was the standard at the university back in the SunOS 4 days. There are probably many advantages using bash over tcsh, but that is a different topic. Since users are able to switch the shell to their preference, and tcsh is still widely used, I think this bug needs to be handled somehow since the result for a tcsh user is just a failed login with no error messages. This will burden the sysadmins a lot trying to figure out why a particular user can't log in when other can. > one idea is to actually log in using /bin/sh, so that we can have a > known login shell, as supporting multiple incompatible shell syntaxes is > a rather difficult task... Sounds like a better approach, agreed. Regards -- Daniel Nilsson
#! /bin/sh /usr/share/dpatch/dpatch-run ## fix_tcsh_logins_daniel.dpatch by <[EMAIL PROTECTED]> ## ## All lines beginning with `## DP:' are a description of the patch. ## DP: No description. @DPATCH@ diff -urNad ldm-2.0.6~/src/ldm.c ldm-2.0.6/src/ldm.c --- ldm-2.0.6~/src/ldm.c 2008-05-31 00:41:45.000000000 +0200 +++ ldm-2.0.6/src/ldm.c 2008-08-17 11:31:38.000000000 +0200 @@ -258,6 +258,7 @@ cmd[i++] = "-l"; cmd[i++] = ldminfo.username; cmd[i++] = ldminfo.server; + cmd[i++] = "env"; cmd[i++] = ltspclienv; /* @@ -315,7 +316,7 @@ cmd[i++] = ";"; cmd[i++] = "kill"; cmd[i++] = "-1"; - cmd[i++] = "$PPID"; + cmd[i++] = "`ps -o ppid -p $$ | tail -1`"; cmd[i++] = NULL; xsessionpid = ldm_spawn(cmd); diff -urNad ldm-2.0.6~/src/sshutils.c ldm-2.0.6/src/sshutils.c --- ldm-2.0.6~/src/sshutils.c 2008-05-31 00:41:45.000000000 +0200 +++ ldm-2.0.6/src/sshutils.c 2008-08-17 11:30:50.000000000 +0200 @@ -68,6 +68,7 @@ sshcmd[i++] = "echo"; sshcmd[i++] = SENTINEL; sshcmd[i++] = ";"; + sshcmd[i++] = "env"; sshcmd[i++] = "LANG=C"; sshcmd[i++] = "/bin/sh"; sshcmd[i++] = "-";