Create a permanent connection between two servers

You may face that you want to make a permenant connection between two servers, there is a command to make that in such a one line

 


cat ~/.ssh/id_rsa.pub | ssh username@ipaddress "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 700 .ssh; chmod 640 .ssh/authorized_keys"

 

for the chmod permission at the end some servers need the permission to be added to the .ssh server so we can access it from other server

we give the folder .ssh permission of 700 and the authorized_key permission 640

Advertisements
Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: