您的当前位置:首页 --> CentOS入门
Centos 7新手上路
浏览次数:1132 关键词 ( 新手  Centos  )

一、Centos 7 修改SSH端口号

1、修改/etc/ssh/sshd_config

vi /etc/ssh/sshd_config

#Port 22         在这行下添加下面这行

Port 7156      //下面添加这一行

 

2、修改SELinux

使用以下命令查看当前SElinux 允许的ssh端口:

安装semanage,

yum -y install policycoreutils-python

semanage port -a -t ssh_port_t -p tcp 7156

 

然后确认一下是否添加进去

semanage port -l | grep ssh

如果成功会输出

ssh_port_t                    tcp    7156, 22

 

3、重启ssh

systemctl restart sshd  (systemctl restart sshd.service)

 

4、firewall开放ssh端口

firewall-cmd --zone=public --add-port=7156/tcp --permanent

firewall-cmd --reload

firewall-cmd --list-all-zones |grep 7156     //查看结果

 

二、无 ifconfig命令,可用yum search ifconfig 查询包

yum -y install net-tools

 

三、hostname保存目录

/etc/hostname

下一条 centos系统中网络配置相关
上一条 centos 挂载ntfs格式U盘

数千企业与站长的选择,7*24小时稳定运行

 了解更多套餐详细