Saturday, February 5, 2011

Allow source server ssh/scp access without a password prompt to target server

If you need to add a host to ~oracle/.ssh/authorized_keys, all you need to do is append the source host's public key to the "authorized_keys" file of the target host, and you're all set.

On Source
scp ~oracle/.ssh/id.???..pub (??? = rsa or dsa, ssh public key) <target>:~oracle/.ssh/<source>.id.???..pub

On Target
cat <source>.id.???..pub >> authorized_keys(chmod 600 authorized_key if it is not)

If the source host doesn't have a public key, then run the following command to generate one:
ssh-keygen -t rsa or ssh-keygen -t dsa (press enter for all prompts. either key type will work).

If a ssh/scp has never been done from the source host to the target host, you will need to run a one time "ssh" command manually, so that the source known_hosts file can be updated with the target hosts name, since this isn't done automatically


1 comment: