有人碰到过吗?
添加了Port 8888,
重启ssh还是监听在22端口,
ListenAddress 0.0.0.0
监听的端口也还在:::22 上
执行过程发一下
step1:
vi /etc/ssh/sshd_config
#Include /etc/ssh/sshd_config.d/*.conf
Port 22
Port 80
Port 8888
Port 44444
Port 33333
#AddressFamily any
ListenAddress 0.0.0.0
step2:
systemctl restart ssh
step3:
netstat -tuln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.54:53 0.0.0.0:* LISTEN
tcp6 0 0 :::22 :::* LISTEN
udp 0 0 127.0.0.1:323 0.0.0.0:*
udp 0 0 127.0.0.54:53 0.0.0.0:*
udp 0 0 127.0.0.53:53 0.0.0.0:*
udp 0 0 172.31.30.7:68 0.0.0.0:*
udp6 0 0 ::1:323 :::*
这个上面只有ssh,没有sshd
lsof -i :22
看看是什么服务监听的
lsof -i :22
systemd 1 root 213u IPv6 6344 0t0 TCP *:ssh (LISTEN)
sshd 3433 root 3u IPv6 6344 0t0 TCP *:ssh (LISTEN)
这不是有sshd吗
systemctl restart sshd
Failed to restart sshd.service: Unit sshd.service not found.
service sshd restart
这个呢
service sshd restart
Failed to restart sshd.service: Unit sshd.service not found.
非生产环境的话,遇事不决 reboot
这一招是可以,但是为什么命令执行的时候不管用呢?
sshd -T看下运行的服务配置文件具体信息,到底是不是你去修改的那个
记得关闭selinux,不然会禁止启动非22端口的ssh端口
systemctl 里面 ssh服务就是 ssh,不用加 d
好像跟ec2-instance-connect有关,没有细究