linux公钥私钥互联

#生成ssh配置文件
ssh root@192.168.224.131
The authenticity of host '192.168.224.131 (192.168.224.131)' can't be established.
RSA key fingerprint is SHA256:TV36UOt/YfJSnHokQucICAjymOh4tGiO7S7VkGsJGwk.
RSA key fingerprint is MD5:7e:8f:22:97:2b:6d:bc:db:ed:e5:5d:fd:a5:ff:2f:f3.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.224.131' (RSA) to the list of known hosts.
root@192.168.224.131's password: 
Last login: Sat Nov 25 13:08:05 2017 from 192.168.224.1

cat known_hosts 
192.168.224.131 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAxd7AHPak0PJYjYoW86dxJfvUT7j7DJnZIqbhegYAfVPyWejTvLsZVr8VF/xPJuaZ9+OvcF+NKoWFRPEEVooL5SyEqYohM0T7Iu0gLEq8HIzjIekIFEBVGIi2Dn2Uuyj0qwQcIa5G4e/S8/yTc/2nmU78hKLuxvBYaTpNlDDunMYBuFkkaAnfBHIwnx69c6JAwkTttcPPBTqD5VL/mzGFIXTH3uVXDb9StxUtWeBf549N3gW3SYpkkorIlMpwIdrhpbjMiIaO4StfUyDLpA/6J9Mv7LVWbz/cmEE4+/cz34VgaDl67HWy5WE3jXJpDuQw+5uJ3aMUzmtM2NsIE48UDw==



#生成公私玥
ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): 
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:
SHA256:OEWz465L9PjLF77AlWCOYWaBqr7gIA3htDaD1pFWbjs root@liyanan_python
The key's randomart image is:
+---[RSA 2048]----+
|    o. o        |
|    =  o o      |
|.. = o= *        |
|+.= o+.O o .    |
|oO . E= S o      |
|+oo  ..* ..      |
|= .  o =. .    |
|=.  . + .o      |
| o.  o.+o..    |
+----[SHA256]-----+

cat /root/.ssh/id_rsa.pub 
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGvuLPbBoL1N+Q4ZOaQe8mrVt/dS5WyxivWf0mQ2Y1Aj3wC7SEvRdRad3z/QLDTjVTS/uDDEL3Ol/vo0UtzGVink5hw86c5YZ8ZRyUdZ56bBqi1ZOcpd4sAg0GOQ+2N1pvxikm5lv42K8JrjZhAp2mCvb+t5AcQb3XTJvIgATsBKQXCIziUC/X0FcVzXj4ouPQWtw2PMGFJlfKk/H2D5QhK86qsQXUIRrRmQ67gsV7NpkjfWKznucZxLDdhzooLHNBpzfA72r9ojvB0r1g08qmhmtngZ7/JaG6qaQ1g6l7Mts1Xlz8t4QMY1p4bPiXLdkIa8a05d2M3tG4+8opeeqv root@liyanan_python

#发送公钥给对方
ssh-copy-id "liyanan@192.168.224.131"
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed

/usr/bin/ssh-copy-id: WARNING: All keys were skipped because they already exist on the remote system.
        (if you think this is a mistake, you may want to use -f option)

#无密码登陆
[root@liyanan_python .ssh]# ssh liyanan@192.168.224.131
Last login: Sat Nov 25 13:51:41 2017 from 192.168.224.129

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值