ssh 公钥免密码登陆
2014-10-08 14:34
183 查看
使用ssh公钥实现免密码登录
(2011-04-22 01:24:10)转载▼
标签:杂谈 | 分类: Linux系统 |
有机器A(192.168.1.155),B(192.168.1.181)。现想A通过ssh免密码登录到B。
首先以root账户登陆为例。
1.在A机下生成公钥/私钥对。
[root@A ~]# ssh-keygen -t rsa -P ''
-P表示密码,-P '' 就表示空密码,也可以不用-P参数,这样就要三车回车,用-P就一次回车。
该命令将在/root/.ssh目录下面产生一对密钥id_rsa和id_rsa.pub。
一般采用的ssh的rsa密钥:
id_rsa
私钥
id_rsa.pub 公钥
下述命令产生不同类型的密钥
ssh-keygen -t dsa
ssh-keygen -t rsa
ssh-keygen -t rsa1
2.把A机下的/root/.ssh/id_rsa.pub 复制到B机的
/root/.ssh/authorized_keys文件里,先要在B机上创建好 /root/.ssh 这个目录,用scp复制。
[root@A ~]# scp /root/.ssh/id_rsa.pub
root@192.168.1.181:/root/.ssh/authorized_keys
root@192.168.1.181's password:
id_rsa.pub 100% 223 0.2KB/s 00:00
由于还没有免密码登录的,所以要输入一次B机的root密码。
3.authorized_keys的权限要是600!!!
[root@B ~]# chmod 600 /root/.ssh/authorized_keys
4.A机登录B机。
[root@A ~]# ssh -l
root 192.168.1.181
The authenticity of host '192.168.1.181 (192.168.1.181)' can't be established.
RSA key fingerprint is 00:a6:a8:87:eb:c7:40:10:39:cc:a0:eb:50:d9:6a:5b.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.181' (RSA) to the list of known hosts.
Last login: Thu Jul 3 09:53:18 2008 from root
[root@B ~]#
相关文章推荐
- ssh无密码公钥登陆
- SSH 公钥免密码登陆
- Linux ssh远程登陆方式:密码与公钥
- Xshell5配置ssh免密码登录-公钥与私钥登录linux服务器(xshell如何登陆上阿里云服务器)
- ssh 连接 通过公钥体制,无密码登陆
- 【转载】 ssh 连接 通过公钥体制,无密码登陆
- ssh 连接 通过公钥体制,无密码登陆
- SSH无密钥登陆 与 配置公钥后仍需要输入密码的解决方案
- SSH安全登陆原理:密码登陆与公钥登陆
- Xshell5配置ssh免密码登录-公钥与私钥登录linux服务器(xshell如何登陆上阿里云服务器)
- ssh公钥密钥无密码登陆
- ssh 无法免密码登陆问题
- Shell脚本:使用SSH登陆并更改密码
- ssh免密码登陆小记
- CentOS 配置SSH免密码登陆
- ssh无密码登陆权威指南
- 使用ssh公钥实现免密码登录
- hadoop 配置集群之间SSH无密码登陆 (重点推荐)
- Centos6.5下SSH免密码登陆配置
- 实现SSH免密码登陆