重啟 ssh 服務的命令為:systemctl restart sshd。步驟詳解:1. 訪問終端并連接到服務器;2. 輸入命令:systemctl restart sshd;3. 驗證服務狀態:systemctl status sshd。
如何重啟 centos 8 中的 SSH 服務
重啟 SSH 服務的命令:
systemctl restart sshd
步驟詳解:
- 訪問終端:使用 SSH 或本地終端連接到您的 CentOS 8 服務器。
-
輸入命令:鍵入以下命令并按 Enter:
systemctl restart sshd
-
驗證服務狀態:等待命令執行完畢后,使用以下命令驗證 SSH 服務是否正在運行:
systemctl status sshd
輸出應如下所示:
Active: active (running) since Wed 2023-01-04 13:03:14 PST; 15min ago Main PID: 868 (sshd) CGroup: /system.slice/system-ssh.slice/ssh.service ├─868 /usr/sbin/sshd -D └─1016 ssh-agent /usr/bin/dbus-launch --exit-with-session --nofork dbus-uuid=6b1a38d5e46340c1845a2cbfa0c5463f --sh-syntax --close-stderr
說明:
- systemctl restart sshd 命令將重新啟動 SSH 服務。
- systemctl status sshd 命令將顯示 SSH 服務的狀態。
- 如果服務未運行,您可以使用 systemctl start sshd 命令啟動它。