青岛网站建设开发外包,王野天简历,上海公司网站建设以子,网站建设怎么谈本次演示以SSH服务为例#xff0c;SSH默认监听端口是22,先保留了22端口#xff0c;所以我们要进入ssh的配置文件添加新端口并注释或删掉原有端口。
1、使用vi编辑器修改文件 sshd_config,路径是/etc/ssh/sshd_config,找到“#Port 22”,添加新的端口号10086。 2、如果你关闭了… 本次演示以SSH服务为例SSH默认监听端口是22,先保留了22端口所以我们要进入ssh的配置文件添加新端口并注释或删掉原有端口。
1、使用vi编辑器修改文件 sshd_config,路径是/etc/ssh/sshd_config,找到“#Port 22”,添加新的端口号10086。 2、如果你关闭了SELinux,可以忽略第二步
先查看SELinux开放给ssh使用的端口
semanage port -l | grep ssh 可以看到我的系统SELinux没有给SSH开放10086端口那么咱们自己添加进去
semanage port -a -t ssh_port_t -p tcp 10086
再次查看结果 3、如果你关闭了防火墙可以忽略第三步
检查防火墙是否开通10086端口
firewall-cmd --permanent --query-port10086/tcp结果显示未开通10086端口需要开通
firewall-cmd --permanent --add-port10086/tcp
再次检查端口已开通 4、重启SSH服务和防火墙
systemctl restart sshd
systemctl status sshd systemctl restart firewalld.service
systemctl status firewalld.service 5、尝试通过10086端口登录SSH 注意事项
在查看SELinux开放给ssh使用的端口(semanage port -l| grep ssh)时
如果提示bash: semanage: command not found
则执行下面命令
使用yum查找提供此功能的的软件包yum provides semanage
安装policycoreutils-python软件包yum install policycoreutils-python -y
然后再执行上面的命令
查阅了相关资料发现是CentOS8上这个包已经换了一个名称了
Its renamed in el8: policycoreutils-python-utils-2.9-9.el8.noarch
于是使用命令yum -y install policycoreutils-python-utils ,成功安装semanage