Centos7更改sshd监听端口号&配置selinux

来自三线的随记

selinux开启。

需要用到semanage命令

查看semanage命令提供者

yum provides semanage

安装工具

yum -y install policycoreutils-python

修改selinux

semanage port -m -t ssh_port_t -p tcp 443

修改sshd配置文件/etc/ssh/sshd_configPort字段

重启sshd服务

systemctl restart sshd

成功监听

通过ss、netstat或lsof等命令可以查看

ss -nplt| grep sshd
lsof -iTCP:22 -sTCP:LISTEN -n
lsof -iTCP -sTCP:LISTEN -n | grep sshd