環境
操作系統: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