Ubuntu和CentOS如何配置SSH使得无密码登陆(2)

[root@localhost ~]# vim /etc/ssh/sshd_config
RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile      .ssh/authorized_keys
其余的步骤和开始的一样如下所示:

[linuxidc@localhost ~]$ ssh-keygen -t dsa -P ''
Generating public/private dsa key pair.
Created directory '/home/linuxidc/.ssh'.
Your identification has been saved in /home/linuxidc/.ssh/dsa.
Your public key has been saved in /home/linuxidc/.ssh/dsa.pub.
The key fingerprint is:
15:57:37:f1:ee:05:26:3a:9e:e1:aa:b3:11:27:b3:1a linuxidc@localhost.localdomain
The key's randomart image is:
+--[ DSA 1024]----+
|          . ...oo|
|          o  .o|
|          . . o .|
|        . . o o |
|      + S +    o|
|      * o +  ..|
|    E o  +    .|
|    o.. .      |
|    . o+.        |
+-----------------+
[linuxidc@localhost ~]$ cat ~/.ssh/dsa.pub >> ~/.ssh/authorized_keys
[linuxidc@localhost ~]$ ssh localhost
The authenticity of host 'localhost (127.0.0.1)' can't be established.
RSA key fingerprint is f3:f8:0b:26:a1:8e:14:55:34:ec:cb:99:f8:70:2c:d3.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'localhost' (RSA) to the list of known hosts.
Last login: Fri Aug  9 08:39:32 2013 from 192.168.142.1
[linuxidc@localhost ~]$

好了,配置完成了。

相关阅读:

Ubuntu 下配置 SSH服务全过程及问题解决

Ubuntu 12.04下安装Git,SSH及出现的Permission denied解决办法

Ubuntu 12.10下OpenSSH的离线安装方法

Ubuntu下SSH安装或设置

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/18845.html