全部博文(77)
分类: LINUX
2011-02-14 14:36:09
在工作中由于常用到ssh登录其它机器,所在每台机器上做了ssh认证,这样就不用每次都输入繁琐的密码。
有两台机器:server_1 和 server_2
账号都为:work
转到work账号下:su - work
运校簊sh-keygen -d (一路回车下去 )
命令输出为:
Enter file in which to save the key (/home/work/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/work/.ssh/id_dsa.
Your public key has been saved in /home/work/.ssh/id_dsa.pub.
The key fingerprint is:
32:21:e1:3b:7d:6e:de:4b:39:da:af:38:fe:90:40:61
在/home/work目录下就产生了.ssh的隐含目录,进入些目录下产生两个文件:
id_dsa ------------ 私钥文件
id_dsa.pub ------------ 公钥文件
将id_dsa.pub复制一份文件名为:authorized_keys2
并将 authorized_keys2 的属性改为 600 即文件所属用户有读和写的权限,组用户和其它用户禁止读写,用命令:
代码: