views:

82

answers:

1

How do you setup server to server SFTP to use public-key authentication instead of user account and password?

+4  A: 

on client you need to generate its public key and add it to server's authorized key list.

ssh-keygen -t dsa -f id_dsa //on client machine
mv id_dsa* ~/.ssh/ //on client machine
scp ~/.ssh/id_dsa.pub USER_NAME@SERVER:~/.ssh/HOST_NAME.key // on client machine
cat ~/.ssh/HOST_NAME.key >> ~/.ssh/authorized_keys2 // on server 

bhups
Use `ssh-copy-id` instead of your `scp` + `cat` dance.
ephemient
Nice, like that ssh-copy-id. I'm on a HP-UX and wish it were installed.
happyappa
Oh right... I forget that not all the world uses OpenSSH. Sad.
ephemient