- 论坛徽章:
- 0
|
我的操作过程如下:
1,建立key:
在192.168.0.109下用bak帐号执行如下命令:
[bak@stick1 ~]$ ssh-keygen -t dsa -b 2048 -f /home/bak/192.168.0.109-rsync-key
Generating public/private dsa key pair.
Enter passphrase (empty for no passphrase): [press enter here]
Enter same passphrase again: [press enter here]
Your identification has been saved in /home/bak/192.168.0.109-rsync-key.
Your public key has been saved in /home/bak/192.168.0.109-rsync-key.pub.
The key fingerprint is:
14:10:f3:e2:d2:01:4f:23:e3:f3:5a:7f:8f:63:dc:b9 bak@stick1
2,分发公钥:
在192.168.0.109下用bak账号执行scp命令
[bak@stick1 ~]$ scp 192.168.0.109-rsync-key.pub bak@192.168.0.222:/home/bak
The authenticity of host '192.168.0.222 (192.168.0.222)' can't be established.
RSA key fingerprint is ac:bb:5f:4c:7e:34:0e:da:45:b2:14:83:2e:46:7a:a6.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.0.222' (RSA) to the list of known hosts.
bak@192.168.0.222's password:
192.168.0.109-rsync-key.pub 100% 1112 1.1KB/s 00:00
3,为192.168.0.222的bak添加公钥
用bak账号在192.168.0.222的/home/bak/.ssh/下建立文件authorized_keys ,接下来将刚拷贝到 /home/bak/下的192.168.0.109-rsync-key.pub的内容导入 /home/bak/.ssh/authorized_keys
用如下命令:
cat /home/bak/192.168.0.109-rsync-key.pub > /home/bak/.ssh/authorized_keys
4.用bak登录192.168.0.109,输入如下命令:
[bak@stick1 ~]$ ssh 192.168.0.222
bak@192.168.0.222's password:
可就在这一步问题出来了,如果我做的正确,就不应该还提示让我输入密码.
请问有哪位高手知道我以上的步骤中到底哪里出了问题?
谢谢大家帮助! |
|