
ssh服務(wù)
二、安裝ssh服務(wù)
安裝在虛擬機下的Centos7想要在局域網(wǎng)中使用,則必須安裝ssh服務(wù)。
1.查看是否安裝了ssh服務(wù):
[root@localhost /]# rpm -qa|grep -E "openssh"
顯示結(jié)果如下,則表示已經(jīng)安裝,否則需要安裝缺失的軟件。
[圖片上傳失敗...(image-6f45c4-1526340872923)]2.安裝缺失的軟件:
[root@localhost /]# yum install openssh*
3.啟動ssh服務(wù):
[root@localhost /]# service sshd start
4.開啟防火墻的22端口:
[root@localhost /]# firewall-cmd --zone=public --add-port=22/tcp --permanent
[root@localhost /]# service firewalld restart
5.安裝完成ssh服務(wù)后不一定可以直接連接,還需要對虛擬機網(wǎng)絡(luò)進行配置:
a.進入網(wǎng)絡(luò)配置文件
[root@localhost /]# cd /etc/sysconfig/network-scripts

b.使用vim編輯器配置ifcfg-ens33文件
[root@localhost /etc/sysconfig/network-scripts]# vim ifcfg-ens33

image
c.由于在虛擬機里安裝centos,要要給其他局域網(wǎng)用戶使用,所以選擇橋接模式

設(shè)置橋接模式
d.然后執(zhí)行systemctl restart network,重啟網(wǎng)絡(luò)服務(wù)

6.使用局域網(wǎng)內(nèi)的終端進行ssh連接:

參考:Linux中國
博客:Barry’Blog