我通过systemctl disable ssh禁用ssh服务器,然后重新启动。重新启动后,我仍然可以通过ssh登录到远程服务器。我使用systemctl status ssh来检查服务器状态,它是不活动的。
$ systemctl -a | grep ssh
ssh.service loaded inactive dead OpenBSD Secure Shell server
ssh@3-192.168.0.120:22-192.168.0.104:31079.service loaded active running OpenBSD Secure Shell server per-connection daemon (192.168.0.104:31079)
system-ssh.slice loaded active active system-ssh.slice
ssh.socket loaded active listening OpenBSD Secure Shell server socket
这很像:
—
codexplorer
● ssh.service - OpenBSD Secure Shell server Loaded: loaded (/lib/systemd/system/ssh.service; enabled; vendor preset: enabled) Active: inactive (dead) since Tue 2019-07-09 23:25:16 CST; 1s ago
另外,您应该在防火墙上阻止端口22,以便即使SSH服务器正在以某种方式运行,也无法从远程访问它。
—
dr01
systemctl status ssh
到您的问题吗?