免密登录和远程执行命令

无需要密码登录 linux 服务器并运行命令。

ssh-keygen -t rsa # 分别在两台电脑上运行此命令, 生成密匙
scp -p ~/.ssh/id_rsa.pub root@IP:/root/.ssh/authorized_keys # 上传本地公钥到服务器
ssh root@IP "cd /home; ls" # 远程执行命令

猜你喜欢

转载自www.cnblogs.com/daysme/p/9392812.html
今日推荐