Setup SFTP to use public-key authentication
问题 How do you setup server to server SFTP to use public-key authentication instead of user account and password? 回答1: In the client you need to generate its public key and add it to server's authorized key list. The following are the commands you can use. On client machine ssh-keygen -t dsa -f id_dsa mv id_dsa* ~/.ssh/ scp ~/.ssh/id_dsa.pub USER_NAME@SERVER:~/.ssh/HOST_NAME.key On the server cat ~/.ssh/HOST_NAME.key >> ~/.ssh/authorized_keys2 回答2: Remember to chmod 700 .ssh and also chmod 600