SELinux(Security-Enhanced Linux) 是美国国家安全局(NSA)对于强制访问控制的实现,是 Linux历史上最杰出的新安全子系统
使用命令的时候发现:
getsebool -a | grep ftp
出现以下信息:
[root@VM-0-9-centos ~]# getsebool -a | grep ftp
getsebool: SELinux is disabled
解决办法是修改/etc/selinux/config配置文件:
vi /etc/selinux/config
强制模式SELINUX=enforcing:表示所有违反安全策略的行为都将被禁止。
宽容模式SELINUX=permissive:表示所有违反安全策略的行为不被禁止,但是会在日志中作记录
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
#默认是disabled,需要更改为permissive
SELINUX=permissive
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
但一个坑来了,我修改了执行命令,还是显示getsebool: SELinux is disabled
解决办法:
修改config文件后,需要重启实例,但直接重启实例将会出现系统无法启动的错误。因此在重启之前需要在根目录下新建autorelabel文件。
touch /.autorelabel
shutdown -r now
最后执行命令,成功执行:
[root@VM-0-9-centos ~]# getsebool -a | grep ftp
ftpd_anon_write --> off
ftpd_connect_all_unreserved --> off
ftpd_connect_db --> off
ftpd_full_access --> off
ftpd_use_cifs --> off
ftpd_use_fusefs --> off
ftpd_use_nfs --> off
ftpd_use_passive_mode --> off
httpd_can_connect_ftp --> off
httpd_enable_ftp_server --> off
tftp_anon_write --> off
tftp_home_dir --> off