Everywhere I have ever worked we have always used complex scripts to push out id files to enable passwordless authentication from a bastion host. Today I stumbled across ssh-copy-id which is about as easy to use as it gets.
Check out the section below for usage and substitute your servers hostname where you see <yourhost>
# ssh-copy-id -i ~/.ssh/id_rsa.pub <yourhost>
You will get output similar to what is shown below.
Now try logging into the machine, with “ssh ‘<yourhost>'”, and check in:
.ssh/authorized_keys
to make sure we haven’t added extra keys that you weren’t expecting.
Checkout the link below for more info
Below is a little wrapper script that I use to make using ssh-copy-id even easier. Please feel free to borrow it for a bit.
[code language=”css”]
#!/bin/bash
echo "Please Enter Server Name :"
read servername
ssh-copy-id -i ~/.ssh/id_rsa.pub $servername
[/code]