Centos7沒法使用ssh登錄及解決方案

查看狀態:bash

systemctl status sshd.service

啓動服務:服務器

systemctl start sshd.service

重啓服務:ssh

systemctl restart sshd.service

開機自啓:工具

systemctl enable sshd.service







今天項目組反映,有一臺Centos7服務器沒法使用SSH登錄了,因此我就經過本地登錄到該系統後,發現SSH服務沒有啓動,該判斷方法主要是使用的是netstat方法進行查看;url

1
netstat  -anlpt |  grep  22

說到這,若是是Centos7的話,咱們若是想要使用netstat的命令的話,須要安裝net-tools後才能夠使用3d

1
yum instatll net-tools –y    ----安裝 netstat 工具

嘗試手動啓動sshd服務沒法啓動,提示錯誤(22端口沒有監聽)rest

clip_image001

Centos7下ssh沒獨立log日誌,因此在message下日誌

1
Tail –f  /var/log/message      /usr/sbin/ 缺乏sshd的文件

clip_image002

1
Cd  /usr/sbin/ 下確實沒有提示中的sshd文件或者目錄

clip_image003

因此咱們須要從新安裝便可code

1
yum reinstall openssh-server

clip_image004

安裝完成server

clip_image005

安裝後文件有ssh的文件信息

clip_image006

從新啓動sshd文件便可

1
systemctl start sshd ---啓動sshd服務

clip_image007

相關文章
相關標籤/搜索