I am working with two servers, both of which run FreeBSD 8.4-RELEASE-p1 and OpenSSH_6.1p1. Both servers' ssh_config files, located in /etc/ssh, are identical. Both servers are configured to allow users to remote into a jailed environment using SSH.

As a test, I logged into a test user's jail using SSH keys on both servers, using the following command:

ssh -i ~/.ssh/private_key test-user@server.mydomain.com hello

And the authorized_keys file in both cases specifies the following command to be run after authentication, prepended to the public key (permissions are the same on both servers):


Where test.shsimply performs the following operation:



On one server, the output from the above sh script shows the following:


But on the other server, the result appears not to get stored in SSH_ORIGINAL_COMMAND


The behavior is the same for the respective server for each user jail. My question is - what other configuration would I need to allow the SSH_ORIGINAL_COMMAND variable to be set after authentication in the case of the second server?

  • Try to add env command to test.sh to see if other SSH_* variables are set – citrin Sep 17 '14 at 17:35
  • Thanks. It appears that the env command is not accessible via the user jails. – dtg Sep 20 '14 at 0:02
  • Have you compared the /etc/ssh/sshd_config files on both servers? – chutz Mar 21 '16 at 18:23
  • If you put env |grep -i ssh into that second server's test.sh script, what environment variables are found? Is there a difference between SSH server versions or configurations on the two systems? – Adam Katz Aug 29 '16 at 22:20
  • 1
    @Dylan: If env is not available, you can use set with similar success. It is a shell built-in and would work inside the jail. – chutz Oct 10 '16 at 14:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.