Failed to restart ssh.service: Unit not found.


環境

操作系統:CentOS 7

問題

重啟ssh服務,啟動報錯:Failed to restart ssh.service: Unit not found.

操作步驟

1. 編輯sshd_config文件

vim /etc/ssh/sshd_config

2. 重啟ssh服務

service ssh restart

3. 啟動失敗,報錯

Redirecting to /bin/systemctl restart ssh.service
Failed to restart ssh.service: Unit not found.

解決方案

從 CentOS 7.x 開始,CentOS 開始使用 systemd 服務來代替 daemon,原來管理系統啟動和管理系統服務的相關命令全部由 systemctl命令來代替。

# CentOS 7 
systemctl restart sshd

# CentOS 6
service restart sshd

擴展知識

service 和 systemctl 命令


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM