创建SSH无密码登陆

第一步,产生秘钥

[root@hypcentos ~]# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
e1:57:8e:ef:fe:26:5e:cc:e2:d4:53:53:ba:ca:05:80 root@hypcentos

第二步,不能传输pub密钥(公钥)

[root@hypcentos ~]scp id_rsa.pub root@hypubuntusrv:/root/.ssh/hypcentos

第三步,修改~/.ssh 下的 authorized_keys

root@hypubuntusrv:~/.ssh# cat hypcentos >> authorized_keys

 

记录下来给自己用,也方便他人。

 

 

 

你可能感兴趣的:(ssh)