I wrote a shell script to clone a repository from Git on more than 100 systems where I am logging to each system.
I tested the script by running it on the system that hosts it, but when I run the same script by logging in from other system using SSH, it gives me a "permission denied" error, though the script is present on the same system where I have to make the clone.
I am using Ruby 1.8.7.
For log in purpose I have created another script file in which first I am log in and run the script here is my code for it in my login.sh
here $1
is that I am passing the port parameter to the login.sh
sshpass -p 1234 ssh -p $1 admin@localhost './my_update_steps.sh &'
In script also makes the changes so that it can automatically handle key genration using keygen
. Here is that code:
ssh-keygen -R myhostname
ssh-keyscan -H myhostname >> ~/.ssh/known_hosts
rm ~/.ssh/known_hosts.old
EDIT 1
By using this link I have made the changes in the .ssh/config
file as
Host *
StrictHostKeyChecking no
but still it is given error as
Warning: Permanently added 'XXXX.XXXXX.XXXX.XXX' to the list of known hosts.^M
Permission denied (publickey).^M
fatal: The remote end hung up unexpectedly
How can I resolve this error? Is there something that am I missing? and what is ^M meaning here.