I am having a tough time figuring out a way to execute a .sh file present on my local linux machine on to a remote linux machine which happens to be an AWS ec2 instance. Here's what I am doing on my local machine:
ssh -i sample.pem ec2-user@server_name.amazon.com 'bash -s' < file_to_remotely_execute.sh
Error that I get is:
Warning: Identity file sample.pem not accessible: No such file or directory. Pseudo-terminal will not be allocated because stdin is not a terminal. Host key verification failed.
This was referred to arrive at the above approach.
Possible issues :
~/.ssh/known_hosts
file. Solutions :
400
permissions to the PEM file, ( sudo chmod 400 /path/to/file.pem
). ssh
once, and allow the host.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.