您的位置:首页 > 运维架构 > Linux

Centos 7新手上路

2015-12-11 16:01 567 查看
一、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端口
yum -y install firewalld;
systemctl enable firewalld;
systemctl start firewalld; //安装启动 firewall
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息