码迷,mamicode.com
首页 > 其他好文 > 详细

service adminsetd start

时间:2019-04-03 10:58:06      阅读:186      评论:0      收藏:0      [点我收藏+]

标签:main   id_rsa   私钥   and   文件   root   ide   自动   需要   

模拟场景:192.168.1.5服务器上配置,通过ssh远程免密登录192.168.1.160

1、安装SSH,此处省略
2、生成公钥和私钥,生成的秘钥默认在/root/.ssh/文件夹里面
[root@localhost ~ 09:16:45&&26]# ssh-keygen #默认按enter直至结束
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:2GM5hi5CJhi+6JbmYkHfbbnNzYB3FoFUr+D50gGt9KQ root@localhost.localdomain
The key‘s randomart image is:
+---[RSA 2048]----+
|        ..o.     |
|         ....    |
|.        + o..   |
|oo     +o.O..    |
|+.+ . + SE +.    |
|.=.. o B =oo.    |
|..+ . o =.*o     |
|o= . . . o.o     |
|*o               |
+----[SHA256]-----+

3、把生成的公钥发送到对方的主机上去,用ssh-copy-id命令,自动保存在对方主机的/root/.ssh/authorized_keys文件中去
[root@localhost ~ 09:16:45&&26]# ssh 192.168.1.160 #需要登录密码 
[root@localhost ~ 09:16:45&&26]# ssh-copy-id -i /root/.ssh/id_rsa.pub root@192.168.1.160 
[root@localhost ~ 09:16:45&&26]# ssh 192.168.1.160 #免密登录 

service adminsetd start

标签:main   id_rsa   私钥   and   文件   root   ide   自动   需要   

原文地址:https://www.cnblogs.com/yuanqc/p/10647254.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!