当前位置: 技术问答>linux和unix
ssh做不用密码的连接,为什么每次都要密码呢?高手看看
来源: 互联网 发布时间:2015-12-11
本文导语: 在AS4(u3)上做的,自己连自己,全过程如下(在u1版上这样做一点问题也没有啊),到最后还要密码,晕死了,高手看看给吧。 [root@ora1 etc]# su - oracle [oracle@ora1 ~]$ cd .ssh [oracle@ora1 .ssh]$ rm * -f [oracle@ora1 .ssh]$ ssh-...
在AS4(u3)上做的,自己连自己,全过程如下(在u1版上这样做一点问题也没有啊),到最后还要密码,晕死了,高手看看给吧。
[root@ora1 etc]# su - oracle
[oracle@ora1 ~]$ cd .ssh
[oracle@ora1 .ssh]$ rm * -f
[oracle@ora1 .ssh]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_dsa.
Your public key has been saved in /home/oracle/.ssh/id_dsa.pub.
The key fingerprint is:
4e:1c:dc:e1:ff:a1:72:31:6e:67:d9:2e:17:0e:2e:47 oracle@ora1
[oracle@ora1 .ssh]$ ls
id_dsa id_dsa.pub
[oracle@ora1 .ssh]$ cat id_dsa.pub >authorized_keys
[oracle@ora1 .ssh]$ chmod 644 authorized_keys
[oracle@ora1 .ssh]$ ll -a ..|grep ssh
drwx------ 2 oracle oracle 4096 Aug 24 16:20 .ssh
[oracle@ora1 .ssh]$ ll
total 24
-rw-r--r-- 1 oracle oracle 601 Aug 24 16:20 authorized_keys
-rw------- 1 oracle oracle 672 Aug 24 16:19 id_dsa
-rw-r--r-- 1 oracle oracle 601 Aug 24 16:19 id_dsa.pub
[oracle@ora1 .ssh]$ hostname
ora1
[oracle@ora1 .ssh]$ ssh ora1
The authenticity of host 'ora1 (192.168.100.11)' can't be established.
RSA key fingerprint is d3:cc:bf:18:c4:bf:0b:b1:64:97:b5:c4:12:56:40:4a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ora1,192.168.100.11' (RSA) to the list of known hosts.
oracle@ora1's password:
Last login: Thu Aug 24 13:53:51 2006 from pvt2
[oracle@ora1 ~]$ exit
logout
Connection to ora1 closed.
[oracle@ora1 .ssh]$ ssh ora1
oracle@ora1's password:
[root@ora1 etc]# su - oracle
[oracle@ora1 ~]$ cd .ssh
[oracle@ora1 .ssh]$ rm * -f
[oracle@ora1 .ssh]$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/oracle/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/oracle/.ssh/id_dsa.
Your public key has been saved in /home/oracle/.ssh/id_dsa.pub.
The key fingerprint is:
4e:1c:dc:e1:ff:a1:72:31:6e:67:d9:2e:17:0e:2e:47 oracle@ora1
[oracle@ora1 .ssh]$ ls
id_dsa id_dsa.pub
[oracle@ora1 .ssh]$ cat id_dsa.pub >authorized_keys
[oracle@ora1 .ssh]$ chmod 644 authorized_keys
[oracle@ora1 .ssh]$ ll -a ..|grep ssh
drwx------ 2 oracle oracle 4096 Aug 24 16:20 .ssh
[oracle@ora1 .ssh]$ ll
total 24
-rw-r--r-- 1 oracle oracle 601 Aug 24 16:20 authorized_keys
-rw------- 1 oracle oracle 672 Aug 24 16:19 id_dsa
-rw-r--r-- 1 oracle oracle 601 Aug 24 16:19 id_dsa.pub
[oracle@ora1 .ssh]$ hostname
ora1
[oracle@ora1 .ssh]$ ssh ora1
The authenticity of host 'ora1 (192.168.100.11)' can't be established.
RSA key fingerprint is d3:cc:bf:18:c4:bf:0b:b1:64:97:b5:c4:12:56:40:4a.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ora1,192.168.100.11' (RSA) to the list of known hosts.
oracle@ora1's password:
Last login: Thu Aug 24 13:53:51 2006 from pvt2
[oracle@ora1 ~]$ exit
logout
Connection to ora1 closed.
[oracle@ora1 .ssh]$ ssh ora1
oracle@ora1's password:
|
/etc/ssh/sshd-config里的要求rsa密钥登陆,你做yes设置了吗?