码迷,mamicode.com
首页 > 系统相关 > 详细

两台linux机器之间互连

时间:2017-10-21 00:13:26      阅读:292      评论:0      收藏:0      [点我收藏+]

标签:linux   两台   互相连接   

两台linux机器之间互连

连接的命令及查看  w   

技术分享

说明两个终端在连接      192.168.133.1  是windows     129是Alex2在连接 

技术分享

正确的写法   

技术分享

查看当前登录的  whoami 

技术分享

[root@alex-01 ~]# ssh root@192.168.129   完整的写法   

[root@alex-01 ~]# ssh -p 22 root@192.168.133.129         指定端口的写法   



设置秘钥

技术分享


[root@alex-2 ~]# 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:

68:0d:16:73:5a:56:3d:80:4d:ab:17:3c:68:a6:0f:27 root@alex-2

The key‘s randomart image is:

+--[ RSA 2048]----+

|      o +=+o     |

|       B.o..o    |

|      + + =  .   |

|     . B . o     |

|      E S .      |

|     . = .       |

|        .        |

|                 |

|                 |

+-----------------+

[root@alex-2 ~]# ls /root/.ssh/         查看公钥和私钥 

authorized_keys  id_rsa  id_rsa.pub  known_hosts

查看2的公钥  

技术分享

[root@alex-01 ~]# vi /root/.ssh/authorized_keys 

技术分享

添加进去   

技术分享

重启机器 了  看下selinux  有没启动 需要用getenforce     显示enforcing  证明selinux开启了 打开的   

技术分享

临时关闭   setenforce 0

[root@alex-01 ~]# getenforce   在看状态   

Permissive

技术分享

成功免秘钥    

技术分享


本文出自 “11325852” 博客,请务必保留此出处http://11335852.blog.51cto.com/11325852/1974566

两台linux机器之间互连

标签:linux   两台   互相连接   

原文地址:http://11335852.blog.51cto.com/11325852/1974566

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