deeejay icon

Bash - Create SSH key on remote server

deeejay | PRO | 12/23/15 03:09:56 PM UTC | 0 ⭐ | 343 👁️ | Never ⏰ | []
Bash |

610 B

|

None

|

0 👍

/

0 👎

Generates key on source machine
===
ssh-keygen -t rsa -C root@source_hostname.domain.org
 
Copies key to target machine
===
ssh-copy-id root@target_hostname.domain.org
 
SSH into target machine
===
ssh root@target_hostname.domain.org
 
Copies keys to other servers in cluster
===
ssh-copy-id root@target2_hostname.domain.org
ssh-copy-id root@target3_hostname.domain.org
ssh-copy-id root@target4_hostname.domain.org
 
Troubleshooting
===
chmod 777 /root/.ssh - may fix password prompts after copying key to target server
DO NOT chmod g-w /root/.ssh - Jenkins builds will get "Permission Denied" errors and fail

Comments