-bash: semanage: command not found

案发现场:

[root@centos7_server ~]# semanage fcontext -a -t httpd_sys_content_t /httpdd/
-bash: semanage: command not found

解决方法:

[root@centos7_client ~]# yum provides semanage
policycoreutils-python-2.5-17.1.el7.x86_64 : SELinux policy core python utilities
Repo : ABC
Matched from:
Filename : /usr/sbin/semanage

 [root@centos7_client ~]# ls -l /cdrom/Packages/ | grep polic*

-rw-rw-r-- 2 root root 456316 Aug 10 2017 policycoreutils-python-2.5-17.1.el7.x86_64.rpm

-rw-rw-r-- 2 root root 172424 Aug 10 2017 policycoreutils-sandbox-2.5-17.1.el7.x86_64.rpm
-rw-rw-r-- 3 root root 446164 Aug 10 2017 selinux-policy-3.13.1-166.el7.noarch.rpm
-rw-rw-r-- 2 root root 1726588 Aug 10 2017 selinux-policy-devel-3.13.1-166.el7.noarch.rpm
-rw-rw-r-- 2 root root 6810796 Aug 10 2017 selinux-policy-minimum-3.13.1-166.el7.noarch.rpm
-rw-rw-r-- 2 root root 5018924 Aug 10 2017 selinux-policy-mls-3.13.1-166.el7.noarch.rpm
-rw-rw-r-- 3 root root 6810996 Aug 10 2017 selinux-policy-targeted-3.13.1-166.el7.noarch.rpm
[root@centos7_client ~]# yum -y install /cdrom/Packages/policycoreutils-python-2.5-17.1.el7.x86_64.rpm

.......

[root@centos7_server ~]# semanage fcontext -a -t httpd_sys_content_t /httpdd/
[root@centos7_server ~]# ls -Zd /httpdd/
drwxr-xr-x. root root unconfined_u:object_r:default_t:s0 /httpdd/
[root@centos7_server ~]# semanage fcontext -a -t httpd_sys_content_t /httpdd/*
[root@centos7_server ~]# restorecon -Rv /httpdd/
restorecon reset /httpdd/index.html context unconfined_u:object_r:default_t:s0->unconfined_u:object_r:httpd_sys_content_t:s0
[root@centos7_server ~]#

供参考:http://www.igoodgoodstudy.com/2017/03/27/4/

以上,便是在下学习Linux的时候记录下来两种方法。 如有不正之处,请联系在下。

  E_Mail:[email protected]

  QQ:1958344794

猜你喜欢

转载自www.cnblogs.com/DaniuUnixChina/p/9012653.html