Home > Article > Operation and Maintenance > Check whether the ssh service is turned on in linux
Check whether the ssh service is open (Recommended learning: linux operation and maintenance)
service ssh status
Or:
/etc/init.d/ssh status
Unit test the remote.c function on the virtual machine, first manually check whether ssh is running:
root@dbaudit-desktop:/etc/init.d# /etc/init.d/ssh status
* sshd is running
Or check like this: root@dbaudit-desktop:/etc/init.d# service ssh status
ssh start/running, process 748 root@dbaudit-desktop:~# vi /etc/init.d/ssh stop 关闭ssh服务指令 root@dbaudit-desktop:~# netstat –apntlu 查看端口状态,如果ssh端口22处于listen状态,ssh处于开启。Ssh关闭失败。 root@dbaudit-desktop:~# vi /etc/init.d/ssh 查看ssh脚本内容 root@dbaudit-desktop:~# vi /var/run/sshd.pid 查看ssh进程pid root@dbaudit-desktop:~# start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd 按照脚本命令关闭ssh root@dbaudit-desktop:~# netstat –apntlu 查看端口状态,如果ssh端口22处于listen状态,ssh处于开启
The above is the detailed content of Check whether the ssh service is turned on in linux. For more information, please follow other related articles on the PHP Chinese website!