SSH not disconnecting for non-root user
blubkin at vmware.com
Tue Mar 23 15:16:47 WST 2010
Jesse Jarzynka wrote:
> First post, but hoping maybe you guys can help. I'm sure you know VMware
> ESXi server uses dropbear as an SSH server. I'm having an issue where
> any non-root user I create on the system is not disconnecting properly.
> If I ssh in as the root user, and type "exit" or scp a file, it
> completes fine. If I ssh in as the non-root user I create, and type
> "exit" or scp a file, it just hangs there forever after completing. This
> is a problem because I'm making a script to scp a file off the server
> regularly as the non-root user and it's just hanging after completing.
I have a theory, but it depends on your being wrong about what
happens when you manually ssh in and run something. It would
only apply to remotely invoked commands, i.e. `ssh host ls`.
Any chance you got mixed up?
The theory has to do with a possible race condition. It also
has a second huge hole, which is that I can't explain why it
would act differently for root vs. not-root. Still...
It's trivial to test. Instead of doing `ssh host ls`, try
`ssh host 'ls; sleep 1'`. If I'm right, that should terminate
cleanly for both users.
If you can, conduct this experiment and show me what happens.
Besides allowing a fix at our end, this would also give you a
crude but workable workaround.
> Another odd thing is that if I use the SSH shortcut "~." it does exit
> cleanly. Not sure if maybe something is trying to run on exit? The
> non-root user has write access to it's home directory and everything so
> I'm not sure where to look.
"~." is a command to your local ssh client. If it's determined
to exit, it will succeed in doing so. The trouble with your
remote command exit is that the server end is never telling the
ssh client (on your end) that the connection is done. It has
no reason to exit; it has no intelligence to determine that a
remote `ls` or `exit` should end more quickly than `sleep 10000`.
More information about the Dropbear