SSH -i command not found

ssh

I want a run a script located on server 2 from server 1.

I am running this command line on server 1:

/home/user_x/keys.pem -t -t ec2-user@10.10.10.10 sudo
/home/gather/scripts/startTomcat6_nonroot.sh

Which give me this error:

/home/user_y/tomcat/bin/startup.sh: line 11: uname: command not found

Here is the snippet of this file on server 2 containing the uname command:

#!/bin/sh
os400=false
darwin=false
#line bellow is number 11, the one failing
case "`uname`" in
CYGWIN*) cygwin=true;;
OS400*) os400=true;;
Darwin*) darwin=true;;
esac

Best Answer

The most likely cause for this is a $PATH on server 2 that doesn't include uname; sanity check the environment variables when logged in under that user.