View Full Version : How can I set envireonment for ssh command?

8th May 2009, 09:09 AM
I use this command:

ssh -l user test.sh

and I got the error of "command not found". I have set the PATH variable for the user "user" why it doesn't work on ssh command

8th May 2009, 02:11 PM
Try to enter /sbin/ssh, or /usr/sbin/ssh, or /usr/bin/ssh

8th May 2009, 03:49 PM
Is location of the test.sh script in the PATH variable for 'user' on

8th May 2009, 07:31 PM
When you run:

ssh -l user test.sh

ssh will start a non-interactive, non-login shell on the remote host and execute test.sh. This means that it will not run any ./bashrc files etc and will not set your PATH. In order to run your command you need to give the absolute path, so if test.sh is in /home/user/bin running:

ssh -l user /home/user/bin/test.sh

will work.