Hi All,
I want to copy /.ssh/OM.pub file from source to destination.
Here source IP address, username and password is always fixed.
Whereas destination server IP address, password always gets changed.
From destination server :-
I am trying to write a script in which it should log in to source without asking for password (as it is fixed).
And get the file and put in destination server
Below credentials are for source server
username = root
password = shroot
#!/bin/sh
echo "%%%%%%I am at destination server%%%%%%%%"
echo "%%%%%% log in to source %%%%%%%"
ssh root@10.34.80.53 (here how to pass "shroot" automatically in script)
scp ~/.ssh/id_rsa.pub root@ASK_USER_FOR_DESTINATION_SERVER_IP:/tmp/id_rsa.pub
exit
echo "%%%%%%I am at destination server%%%%%%%%"
cat /tmp/id_rsa.pub >> ~/.ssh/authorized_keys;rm /tmp/id_rsa.pub; chmod 0600 ~/.ssh/
Regards,
Madhur