I am trying to executing a jar file
which is present in remote machine. When I execute below command from my local machine I get error:
ssh -i /root/.ssh/pem_file user@[host_ip]:/home/user/folder1/java -cp jar1.jar -a option1 -e [email protected] -f TextFile.txt
/home/user/folder1/
is the location where jar file
is present on remote machine.The error I get is:
Unknown cipher type 'p'
I then looked up for this error and found out the with ssh
we may not need it. So, I removed -cp from it and executed this command:
ssh -i /root/.ssh/pem_file user@[host_ip]:/home/user/folder1/java jar1.jar -a option1 -e [email protected] -f TextFile.txt
Now I get error as:
ssh: Could not resolve hostname [host name]:/home/user/folder1/java: nodename nor servname provided, or not known
How can I resolve this error?
The command should be passed to
ssh
after hostname separated by space not colon, like this:If you have parts in the command that could be parsed by your local shell before sent to remote host (for example
cd /tmp && ls
orcat /file | uniq > some.log
) it should be enclosed in single quotes: