Jun 7, 2006
I use a hosting company that uses cPanel. I have jailshell ssh access on a nonstandard port. Whenever I use ssh, it returns zero, rather than the exit code of the remote process as it should. I suspect the jailshell has a bug and does not return the exit code of the last process it executes as it should, but I have no way of testing the theory or anything. E.g.

ssh -p 1234 [email protected] exit 5
echo $?

prints 0, not 5!

Is this a bug? Or is there some reason for this strange behaviour (if there is a reason, I have no idea what it could be). It's very unlikely to be an OpenSSH problem, as SSH works fine with similar versions on a number of different servers I have access to, though they all use regular shells.

The exit code is really crucial to scripts and so on, so it would be heaps more helpful if it worked. At the moment I have written a kludge/workaround that saves the exit code in a temporary file on the server and then downloads it...far from ideal and slow and still susceptible to errors...but better...

My company keep up to date with cPanel updates, so as soon as the bug is fixed, I will get the benefit. Keen to see the bug found and fixed!

Anyone have any ideas/knowledge? Anyone able to confirm the theory that the jailshell is at fault (e.g. by running the jailshell from another shell and checking the exit code)? Should I submit the bug to Bugzilla?