2011年(94)
分类: LINUX
2011-04-07 14:13:08
ssh可以使用密钥对互相建立信任,以后再链接信任的计算机就不需要输入密码了。
1、建立密钥对
niu@niu:~$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/niu/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/niu/.ssh/id_rsa.
Your public key has been saved in /home/niu/.ssh/id_rsa.pub.
The key fingerprint is:
27:00:f4:ce:a0:6f:61:a8:55:27:af:9a:bc:2b:d5:21 niu@niu
niu@niu:~$
过程中就一直按回车即可。此时会在 /home/niu/.ssh/ 目录下生成一对文件 id_rsa, id_rsa.pub
2、配置远程计算机
将id_ras.pub文件复制到远程计算机待登录用户个人目录下的.ssh目录中(如不存在自己创建),并将文件名改为 authorized_keys
3、完成