Home  >  Article  >  Operation and Maintenance  >  Check whether the ssh service is turned on in linux

Check whether the ssh service is turned on in linux

(*-*)浩
(*-*)浩Original
2019-11-04 10:04:4922172browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:linux >>what does it meanNext article:linux >>what does it mean