[root@localhost .ssh]# ssh-keygen -d
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa): /home/admin/.ssh/id_dsaEnter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/admin/.ssh/id_dsa.
Your public key has been saved in /home/admin/.ssh/id_dsa.pub.
The key fingerprint is:
5c:70:4f:b5:06:b2:b3:25:d0:e9:91:b3:00:4a:c1:63 root@localhost.localdomain
[root@localhost .ssh]# ls
id_dsa id_dsa.pub
[root@localhost .ssh]# mv id_dsa.pub authorized_key
[root@localhost .ssh]# chmod 644 authorized_key
[root@localhost .ssh]# /etc/rc.d/init.d/sshd restart
停止 sshd: [ 确定 ]
启动 sshd [ 确定 ]
[root@localhost .ssh]# ssh -l admin localhost
Permission denied (publickey).
我在/etc/ssh/sshd_config所做的修改:
PasswordAuthentication no
ChallengeResponseAuthentication no
If this is not possible for some reason, an alternative is to set StrictModes no in sshd_config, however this is not recommended.作者: ArchieYao 时间: 2007-09-29 15:44
今天遇到同样问题,经过一番努力,发现是publickey的目录没有配置好作者: lvcayu 时间: 2012-01-10 14:08