centos7.5,Centos75怎么安装宝塔面板

http://www.itjxue.com  2023-01-20 07:24  来源:未知  点击次数: 

CentOS-7.5 设置 selinux

实验目的:关闭 selinux?

推荐:使用 sed 方式替换

优点:快捷,效率高

使用 sed 设置 selinux? 案例如下:

[root@shell ~]#

[root@shell ~]# cat? /etc/selinux/config? ? ? ? ? ? ?#查看未设置前的 Selinux 配置内容

1、永久关闭selinux

这种方式修改完配置文件以后,需要重启Linux系统才能生效

[root@shell ~]#

[root@shell ~]# sed? -i? s#SELINUX=enforcing#SELINUX=disabled#? ?/etc/selinux/config? ? ? ? ? ? ?#使用sed命令设置selinux为disabled状态

[root@shell ~]#

[root@shell ~]# cat? /etc/selinux/config? ? ? ? ? ? ? ? #查看设置后的 Selinux 配置内容

2、临时关闭selinux

[root@shell ~]#

[root@shell ~]# setenforce? ?0? ? ? ? ? ? ? ? #临时关闭,重启系统就会失效

[root@shell ~]#

[root@shell ~]# getenforce? ? ? ? ? ? ? #查看selinux的当前状态

3、使用1+2的相结合的方式

这种方式不需要重启Linux,也可使修改生效

[root@shell ~]#

[root@shell ~]# sed? -i? s#SELINUX=enforcing#SELINUX=disabled#? /etc/selinux/config? ? ? ? ? ? #先用sed命令进行永久关闭

[root@shell ~]# setenforce? 0? ? ? ? ? ? ? ? ? ? ? ? #然后再执行临时关闭

[root@shell ~]# getenforce? ? ? ? ? ? ? ?#查看修改结果

centOS7.5 配置telnet服务

telnet服务再centos7上是单独的一个服务,不用安装xinetd,只要安装telnet-server,然后启动telnet服务

1,先查看有没有安装telnet服务

rpm -qa | grep telnet? #没有显示则没有安装包

yum list telnet-server #

yum? install telnet-server

yum? install telnet

2,网上看接下来要执行? vi? /etc/xinetd.d/telnet编辑telnet文件 ,但在实验中发现xinetd.d文件夹下没有telnet文件,

直接启动telnet服务

systemctl start telnet.socket? #开启服务

systemctl enable telnet.socket? #开机自启

systemctl status telnet.socket? ?#查看状态

3,telnet 服务开启成功,

使用 ss -tnl? 查看23端口是否开启

可使用CRT测试 telnet LinuxIP地址

4,默认情况下只允许普通用户telnet登录,不允许root用户telnet

su 到root权限 在/etc/securetty文件最后添加pts终端入口

vi /etc/securetty

pts/0

5,卸载telnet

rpm -qa | grep telnet? ?#显示telnet-server和telnet包

telnet-server-0.17-65.el7_8.x86_64

telnet-0.17-65.el7_8.x86_64

rpm -e?telnet-0.17 #卸载telnet客户端

rpm -e telnet-server-0.17 #卸载telnet服务端

CentOS-7.5 使用 iptables

1、关闭 firewalld

由于 firewalld 是 CentOS-7系列的默认防火墙,因此如果想使用iptables的话,需要将CentOS-7系列的默认防火墙?firewalld 关闭,并安装?iptables-services?

[root@shell ~]#

[root@shell ~]# systemctl? stop? firewalld.service? ? ? ? ? ? #关闭

[root@shell ~]# systemctl? disable? firewalld.service? ? ? ? #禁止开机自启动

[root@shell ~]# firewall-cmd? --state? ? ? ? ? #查看firewalld是否在运行

not? running

[root@shell ~]#

2、安装iptables防火墙

[root@shell ~]#

[root@shell ~]# yum install iptables-services? ? ? ? ? ? ? ? ? #安装iptables服务

[root@shell ~]# systemctl? start? iptables

[root@shell ~]# systemctl? enable? iptables? ? ? ? ? ? ? ? ? ? ? #设置iptables为开机自启动

[root@shell ~]#

[root@shell ~]# cat? /etc/sysconfig/iptables? ? ? ? ? ? #查看iptables默认配置

[root@shell ~]#?

[root@shell ~]#

[root@shell ~]# systemctl? start? iptables? ? ? ? ? ? ?#启动?iptables

[root@shell ~]# systemctl? status? iptables? ? ? ? ? ? #查看状态

[root@shell ~]#

[root@shell ~]# iptables? -L? ? ? ? ? ? ? ? ? #查看当前防火墙规则

3、配置防火墙规则

(责任编辑:IT教学网)

更多

推荐Frontpage教程文章