ssh 无密码登陆2

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/ [email protected]:/root/
  [root@chanjet21 .ssh]# scp -r /root/.ssh/ [email protected]:/root/
  [root@chanjet21 .ssh]# scp -r /root/.ssh/ [email protected]:/root/
  此时便可从服务器端无需密码就可以登录到各个节点
本篇文章来源于 黑基网-中国最大的网络安全站点 原文链接:http://www.hackbase.com/tech/2011-07-13/64507.html

你可能感兴趣的:(c,网络,ssh,File,服务器)