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

SSH 互信

时间:2018-06-20 21:11:17      阅读:128      评论:0      收藏:0      [点我收藏+]

标签:serve   style   用户   root   server   file   color   pre   zed   

A:master

B:server

在A B机器 当前用户的绝对目录 进行创建 .ssh 

# mkdir ~/.ssh
# chmod 700 .ssh/
# /usr/bin/ssh-keygen -t rsa
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:
41:21:31:03:97:5b:b2:c6:32:07:98:a5:4c:7d:28:c1 root@10-205-203-191
The key‘s randomart image is:
+--[ RSA 2048]----+
| .o*oo*oo. |
| oE.+.+=. |
| o. + =. |
| o * . |
| = S |
| |
| |
| |
| |
+-----------------+


# cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
# chmod 600 ~/.ssh/authorized_keys

 

拷贝 master 远程机器的 authorized_keys;粘贴到被远程的server 机器上; 然后直接远程就可以了

 

2、可以设置一个脚本进行执行;

然后把堡垒机的auth 拷贝到服务的机器上;

# cat in.sh

# cat in.sh

mkdir ~/.ssh chmod 700 .ssh/ /usr/bin/ssh-keygen -t rsa cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys chmod 600 ~/.ssh/authorized_keys

 

SSH 互信

标签:serve   style   用户   root   server   file   color   pre   zed   

原文地址:https://www.cnblogs.com/sharesdk/p/9205168.html

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