SSH_ORIGINAL_COMMAND variable not getting set
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 [email protected] 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):
command="~/test.sh",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty
Where test.sh
simply performs the following operation:
#!/bin/sh
echo SSH_ORIGINAL_COMMAND = $SSH_ORIGINAL_COMMAND
On one server, the output from the above sh
script shows the following:
SSH_ORIGINAL_COMMAND = hello
But on the other server, the result appears not to get stored in SSH_ORIGINAL_COMMAND
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?
Look in /etc/profile and other init scripts (~/.bashrc etc) - those are some things which set environment variables.
Remember that you need a ". " in place of scripts if you want their environment settings they set up to "stick".