Check whether the ssh service is turned on in linux

(*-*)浩
Release: 2019-11-04 10:04:49
Original
22139 people have browsed it

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
Copy after login

Or:                                                                                                                                              

/etc/init.d/ssh status
Copy after login

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
Copy after login

* 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处于开启
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!