centos 不小心執行 chmod -R 777 /

centos 不小心執行 chmod -R 777 /。感覺要跑路了

一.SSH無法登陸修復

  • 1.無法通過ssh遠程登錄,我的是阿里雲服務器,還可以通過阿里雲遠程連接->發送遠程命令。執行systemctl status sshd,有如下保存。大概問題就是/etc/ssh/權限太高,把權限改下。執行chmod -R 600 /etc/ssh/
sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Tue 2020-06-30 17:38:12 CST; 8s ago
     Docs: man:sshd(8)
           man:sshd_config(5)
  Process: 3595 ExecStart=/usr/sbin/sshd -D $OPTIONS (code=exited, status=1/FAILURE)
 Main PID: 3595 (code=exited, status=1/FAILURE)

Jun 30 17:38:12 iZuf61hywcggja2gy9wn6oZ sshd[3595]: Permissions 0737 for '/etc/ssh/ssh_host_ed25519_key' are too open.
Jun 30 17:38:12 iZuf61hywcggja2gy9wn6oZ sshd[3595]: It is required that your private key files are NOT accessible by others.
Jun 30 17:38:12 iZuf61hywcggja2gy9wn6oZ sshd[3595]: This private key will be ignored.
Jun 30 17:38:12 iZuf61hywcggja2gy9wn6oZ sshd[3595]: key_load_private: bad permissions
Jun 30 17:38:12 iZuf61hywcggja2gy9wn6oZ sshd[3595]: Could not load host key: /etc/ssh/ssh_host_ed25519_key
Jun 30 17:38:12 iZuf61hywcggja2gy9wn6oZ sshd[3595]: sshd: no hostkeys available -- exiting.
Jun 30 17:38:12 iZuf61hywcggja2gy9wn6oZ systemd[1]: sshd.service: main process exited, code=exited, status=1/FAILURE
Jun 30 17:38:12 iZuf61hywcggja2gy9wn6oZ systemd[1]: Failed to start OpenSSH server daemon.
Jun 30 17:38:12 iZuf61hywcggja2gy9wn6oZ systemd[1]: Unit sshd.service entered failed state.
Jun 30 17:38:12 iZuf61hywcggja2gy9wn6oZ systemd[1]: sshd.service failed.

  • 2.更改文件權限後,再次執行systemctl status sshd,如下提示,表示成功了
● sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2020-06-30 17:42:25 CST; 16s ago
     Docs: man:sshd(8)
           man:sshd_config(5)
 Main PID: 4486 (sshd)
   CGroup: /system.slice/sshd.service
           └─4486 /usr/sbin/sshd -D

Jun 30 17:42:25 iZuf61hywcggja2gy9wn6oZ systemd[1]: Starting OpenSSH server daemon...
Jun 30 17:42:25 iZuf61hywcggja2gy9wn6oZ sshd[4486]: Server listening on 0.0.0.0 port 222.
Jun 30 17:42:25 iZuf61hywcggja2gy9wn6oZ systemd[1]: Started OpenSSH server daemon.
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章