生成公钥和密钥 ssh-keygen -t rsa -C "user@example.com" 拷贝到目标服务器 ssh-copy-id -i ~/.ssh/id_rsa.pub root@1.1.1.1 重要提示 目标服务器的目标用户的~/.ssh目录权限必须是700 目标服务器的目标用户的~/.ssh/authorized_keys目录权限必须是600 否则免密登陆不起作用