linux 免用户名登录 (RSA认证登录)
2011-04-12 14:43
253 查看
在Linux运维中,经常需要写脚本。如何免用户名登录其他linux服务器是非常重要的。比如,输入 ssh root@192.168.1.1就能直接登录192.168.1.1
方法如下:
1、比如,我需要从192.168.1.2 登录192.168.1.1 ,那么我需要在192.168.1.2 执行
ssh-keygen -t rsa ,该命令以root用户执行。执行完毕后,会在/root/.ssh/目录下生成
id_rsa id_rsa.pub 两文件。
2、在192.168.1.1 /root/.ssh/ 目录下,建立文件 authorized_keys
如果没有该目录,请执行ssh-keygen -t rsa
3、将id_rsa.pub 中的内容复制到authorized_keys中去。
PS: 如果还有其他机器需要登录192.168.1.1,并且要求免用户名登录的话。只需要在本机生成rsa密钥,并且把pub(公钥)的内容添加到需要被登录的机器的authorized_keys中即可。
PS: 如果提示
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
44:c9:d4:86:d4:1d:bb:f7:7a:a0:9a:64:75:1e:29:55.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending key in /root/.ssh/known_hosts:12
RSA host key for 10.4.33.70 has changed and you have requested strict checking.
Host key verification failed.
那么请注意,那是因为以前有登陆信息保存在本机的know_hosts 内,保存的是对方的key,删除后即可登陆
方法如下:
1、比如,我需要从192.168.1.2 登录192.168.1.1 ,那么我需要在192.168.1.2 执行
ssh-keygen -t rsa ,该命令以root用户执行。执行完毕后,会在/root/.ssh/目录下生成
id_rsa id_rsa.pub 两文件。
2、在192.168.1.1 /root/.ssh/ 目录下,建立文件 authorized_keys
如果没有该目录,请执行ssh-keygen -t rsa
3、将id_rsa.pub 中的内容复制到authorized_keys中去。
PS: 如果还有其他机器需要登录192.168.1.1,并且要求免用户名登录的话。只需要在本机生成rsa密钥,并且把pub(公钥)的内容添加到需要被登录的机器的authorized_keys中即可。
PS: 如果提示
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
44:c9:d4:86:d4:1d:bb:f7:7a:a0:9a:64:75:1e:29:55.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending key in /root/.ssh/known_hosts:12
RSA host key for 10.4.33.70 has changed and you have requested strict checking.
Host key verification failed.
那么请注意,那是因为以前有登陆信息保存在本机的know_hosts 内,保存的是对方的key,删除后即可登陆
相关文章推荐
- Linux-ssh的rsa认证登录配置
- linux SSH rsa认证方式登录需理清的问题
- linux下的shell——如何修改shell的提示符,能够出现登录用户名、主机名和路径
- OpenLDAP+SSL+SSSD 实现Linux登录集中认证
- linux中ssh登录Permanently added (RSA) to the list of known hosts问题解决
- app与后台的token、sessionId、RSA加密登录认证与安全解决方案
- linux中文本操作界面登录时,用户名,密码均正确,却链接错误
- LDAP接管LINUX登录认证
- 后台的token、sessionId、RSA加密登录认证与安全解决方案
- linux下免密认证登录失败原因总结
- linux安全之使用rsa证书进行登录
- app与后台的token、sessionId、RSA加密登录认证与安全解决方案
- 亚马逊AWS CentOS7(linux)改为用户名密码登录
- Linux配置SSH公钥认证与Jenkins远程登录进行自动发布
- linux中ssh登录Permanently added (RSA) to the list of known hosts问题解决
- Linux的SSH2(RSA)验证登录
- linux下查看可用登录用户名
- 不输入用户名密码通过跳板机登录到线上linux机器