知识屋:更实用的电脑技术知识网站
所在位置:首页 > 操作系统 > linux

ssh无密码访问

发布时间:2014-09-05 17:12:22作者:知识屋

 1.在服务器端(192.168.0.1)产生密钥
[root@chanjet21 ~]# cd /root/.ssh/
[root@chanjet21 .ssh]# ls
known_hosts
[root@chanjet21 .ssh]# ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
26:67:d7:2c:27:8f:01:ea:a6:6c:34:d3:9d:04:ac:08 root@chanjet21
[root@chanjet21 .ssh]# ls
id_dsa  id_dsa.pub  known_hosts
于是生成了id_dsa  id_dsa.pub两个文件。
2. #cp id_sda.pub authorized_keys
3.然后将.ssh文件夹拷贝覆盖各个节点间.ssh目录
[root@chanjet21 .ssh]# scp -r /root/.ssh/ root@192.168.0.2:/root/
[root@chanjet21 .ssh]# scp -r /root/.ssh/ root@192.168.0.3:/root/
[root@chanjet21 .ssh]# scp -r /root/.ssh/ root@192.168.0.4:/root/
此时便可从服务器端无需密码就可以登录到各个节点。
(免责声明:文章内容如涉及作品内容、版权和其它问题,请及时与我们联系,我们将在第一时间删除内容,文章内容仅供参考)
收藏
  • 人气文章
  • 最新文章
  • 下载排行榜
  • 热门排行榜