标签:ssh免密码登录
Linux 为例方便ssh登录,避免交互输入密码,可以简单配置ssh互信来完成 192.168.2.9 本地主机 192.168.2.109 远程主机 在2.9上执行的命令: 一路回车敲下去 [root@2.9 ~]# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: f6:51:47:62:dc:3f:d4:df:1e:85:87:96:7b:58:29:ea root@2.9 [root@2.9 ~]# ssh root@192.168.2.109 "mkdir .ssh;chmod 0700 .ssh" root@192.168.2.109‘s password:(需要输入密码) [root@2.9 ~]# scp ~/.ssh/id_rsa.pub root@192.168.2.109:.ssh/id_rsa.pub root@192.168.2.109‘s password:(需要输入密码) 在2.109上的命令: [root@2.109~]# touch /root/.ssh/authorized_keys [root@2.109~]# <# cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys2 (将id_rsa.pub的内容追加到 authorized_keys 中) 在2.9 ssh 登陆测试: # ssh root@192.168.2.109 (不需要密码, 登录成功)
本文出自 “O Record” 博客,请务必保留此出处http://evils798.blog.51cto.com/8983296/1420872
标签:ssh免密码登录
原文地址:http://evils798.blog.51cto.com/8983296/1420872