解决SCP命令需要输入密码的问题

需求:主机A(ipA)文件复制到主机B(ipB)

step1、主机A生成配对秘钥

在root目录下执行:

ssh-keygen -t rsa

step 2、将 .ssh 目录中的 id_rsa.pub 文件复制到 主机B 的 ~/.ssh/ 目录中,并改名为 authorized_keys

scp ~/.ssh/id_rsa.pub ipB:/root/.ssh/authorized_keys

你可能感兴趣的:(服务器,脚本,linux)