• 31st, Aug 2009

SSH Create Host – User Key to connect

#
# SSH create a connection host key
#
# Setting up RSync over SSH with No Password
# It's actually very simple. Just follow these few steps:
# ---- 1 ----
# As the user you are going to be running rsync as, and on the machine you will be running rsync on, type:
ssh-keygen -t rsa
# Follow the prompts and use the defaults for the filenames it gives you. Don't enter in a passphrase, otherwise you will still be prompted for a password when trying to connect.
# You should then have two new files in ~/.ssh, id_rsa and id_rsa.pub.
# ---- 2 ----
# Open ~/.ssh/id_rsa.pub and copy the line in it to the ~/.ssh/authorized_keys file on the host you will be connecting to as the user you will be logging in as.
# ---- 3 ----
# Now try it out. Try ssh'ing from the host you created the id_rsa* files on to the one you added a line to the authorized_keys file. You won't be prompted for a password any more.
# ---- 4 ----
# Make sure the folder and files have the right permissions.
chmod 700 /home/nacho/.ssh
chmod 600 /home/nacho/.ssh/authorized_keys
# ---- 5 ----
# Test it!

#
# Example:
#

# Host server:
ls root/.ssh/
-rw-r--r-- 1 root root 424 Feb 26 15:38 authorized_keys
-rw------- 1 root root 672 Feb 25 17:48 id_dsa
-rw-r--r-- 1 root root 621 Feb 25 17:48 id_dsa.pub

cat authorized_keys:
ssh-rsa AA...L8vOA+w== ServerBackup@Server-Backups-Mac-Mini.local

# User server:
ls Users/ServerBackup/.ssh/
-rw-------  1 ServerBackup  staff  1675  4 Jul  2009 id_rsa
-rw-r--r--  1 ServerBackup  staff   424  4 Jul  2009 id_rsa.pub
-rw-r--r--  1 ServerBackup  staff  1246 26 Feb 15:44 known_hosts

cat known_hosts
server.unexpectedit.com,172.123.123.238 ssh-rsa AAAAB3NzaC1...psoQ==

Tags: , ,

Leave a Reply

*

© 2010 unexpected[it]. All Rights Reserved.