Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the common command semanage in Linux

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to use the Linux command semanage. I hope you will get something after reading this article. Let's discuss it together.

The Linux common command semanage command is used to query and modify the security context of the SELinux default directory.

Syntax format semanage [parameters]

Common parameters:-l query-an increased, you can add some directory default security context type settings-m modify-d delete reference instance query / var/www/html default security settings in this article:

[root@linux265 ~] # semanage fcontext-l use the semanage command to set the default security of the / srv/samba directory. This article is public_content_t:

[root@linux265 ~] # mkdir / srv/samba ll-Zd / srv/samba drwxr-xr-x root root root:object_r:var_t / srv/samba as shown above, the default should be var_t:

[root@linux265 ~] # semanage fcontext-l | grep'/ srv' / srv/.* all files system_u:object_r:var_t:s0 / srv/ ([^ /] * /)? ftp (/. *)? All files system_u:object_r:public_content_t:s0 / srv/ ([^ /] * /)? www (/. *)? All files system_u:object_r:httpd_sys_content_t:s0 / srv/ ([^ /] * /)? rsync (/. *)? All files system_u:object_r:public_content_t:s0 / srv/gallery2 (/. *) All files system_u:object_r:httpd_sys_content_t:s0 / srv directory system_u:object_r:var_t:s0 above is the default security information under / srv. However, it is not specified to / srv/samba:

[root@linux265] # semanage fcontext-a-t public_content_t "/ srv/samba (/. *)? [root@linux265 ~] # semanage fcontext-l | grep'/ srv' / srv/samba (/. *)? All files system_u:object_r:public_content_t:s0 attempts to restore the default values:

[root@linux265] # restorecon-Rv / srv/samba* after reading this article, I believe you have a certain understanding of "how to use Linux commands semanage". If you want to know more about it, please follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report