1, 生成ssh-key: ssh-keygen -t rsa 2, 添加到远程机器: cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'