Linux查看sshd服务是否开启
时间: 2024-02-16 11:29:20 浏览: 151
Linux sshd_config配置手册中文版
您可以使用以下命令来查看sshd服务是否开启:
```
systemctl status sshd
```
如果服务正在运行,则显示类似以下输出:
```
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: yes)
Active: active (running) since Sun 2020-09-27 16:06:08 UTC; 19min ago
Docs: man:sshd(8)
man:sshd_config(5)
Process: 346 ExecStartPre=/usr/sbin/sshd-keygen (code=exited, status=0/SUCCESS)
Main PID: 365 (sshd)
Tasks: 1 (limit: 11583)
Memory: 1.6M
CGroup: /system.slice/sshd.service
└─365 /usr/sbin/sshd -D
```
如果服务没有运行,则显示类似以下输出:
```
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: yes)
Active: inactive (dead) since Sun 2020-09-27 16:00:00 UTC; 26min ago
Docs: man:sshd(8)
man:sshd_config(5)
Process: 275 ExecStart=/usr/sbin/sshd -D $SSHD_OPTS (code=exited, status=255/EXCEPTION)
Main PID: 275 (code=exited, status=255/EXCEPTION)
```
阅读全文