linux远程登录ssh免密码

来源:互联网 发布:软件测试 patton 招聘 编辑:程序博客网 时间:2024/05/29 08:29

转自:http://blog.csdn.net/zhuying_linux/article/details/7049078

截一段吧:

1.登录ServerA

2.ssh-keygen -t  rsa,将会生成公钥和私钥文件id_rsa和id_rsa.pub【如果一直回车下去,最后这两个文件应该在/home/$USER/.ssh下面】

3.将 .pub 文件复制到ServerB机器的 .ssh 目录下,并保存为authorized_keys

可以使用:

ssh-cop-id命令会将指定的公钥文件复制到远程计算机

[Oracle@Test232 ~]$ ssh-copy-id -i ~/.ssh/id_rsa.pub oracle@192.168.55.232
28
oracle@192.168.55.232's password: 
Now try logging into the machine, with "ssh 'oracle@192.168.55.232'", and check in:


  .ssh/authorized_keys


to make sure we haven't added extra keys that you weren't expecting.


[oracle@Test232 ~]$ ssh oracle@192.168.55.232
oracle@192.168.55.232's password: 
Last login: Thu Nov 24 16:05:32 2011 from 192.168.55.229
[oracle@Test232 ~]$ 

4.大功告成,从A机器登录B机器的目标账户,不再需要密码了

0 0
原创粉丝点击