PDA

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



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

ssh -l user 192.168.100.1 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

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

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

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

ssh -l user 192.168.100.1 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 192.168.100.1 /home/user/bin/test.sh

will work.