1.檢查CentOS7是否安裝了openssh-server
[root@centos]# yum list installed | grep openssh-server
2.沒有安裝
執(zhí)行yum install openssh-server 安裝
[root@centos]# yum install openssh-server
3.如果已安裝
找到/etc/ssh/目錄下的sshd服務配置文件 sshd_config,用Vim編輯器打開
取消注釋(去掉#)Post 22、PermitRootLogin(開啟遠程登陸) PasswordAuthentication(開啟使用密碼作為連接遠征)
[root@centos]# vim /etc/ssh/sshd_config
4. 運行sshd服務
[root@centos]# service sshd start
5. 檢查sshd服務狀態(tài)
檢查22號端口是否開啟監(jiān)聽
[root@centos]# ps -e | grep sshd
# 或者
[root@centos]# netstat -an | grep 22
6. 連接測試
7. 設置開機啟動
[root@centos]# systemctl enable sshd.service