当前位置:首页 > CN2资讯 > 正文内容

Linux 操作couchbase命令 linux chcon

2天前CN2资讯


chcon命令:修改对象(文件)的安全上下文。比如:用户:角色:类型:安全级别。
命令格式:

   Chcon [OPTIONS…] CONTEXT FILES…..

   Chcon [OPTIONS…] –reference=PEF_FILES FILES…

说明:

    CONTEXT 为要设置的安全上下文

    FILES 对象(文件)

    --reference 参照的对象

    PEF_FILES 参照文件上下文

    FILES      应用参照文件上下文为我的上下文。

    OPTIONS 如下:

        -f          强迫执行

        -R         递归地修改对象的安全上下文

        -r ROLE    修改安全上下文角色的配置

        -t TYPE    修改安全上下文类型的配置

        -u USER   修改安全上下文用户的配置

        -v         显示冗长的信息

         -l, --range=RANGE    修改安全上下文中的安全级别

范例:

1、ftp

//If you want to share files anonymously <如果你想把这个共享给匿名的话,需要开启以下> chcon -R -t public_content_t /var/ftp//If you want to setup a directory where you can upload files <如果你想让你设置的FTP目录可以上传文件的话,SELINUX需要设置> chcon -t public_content_rw_t /var/ftp/incoming//You must also turn on the boolean allow_ftpd_anon_write <允许匿名用户写入权限> setsebool -P allow_ftpd_anon_write=1//If you are setting up this machine as a ftpd server and wish to allow users to access their home directorories<如果你希望你的FTP用户可以访问自己的家目录的话,需要开启> setsebool -P ftp_home_dir 1//If you want to run ftpd as a daemon<如果你希望将vsftpd以daemon的方式运行的话,需要开启> setsebool -P ftpd_is_daemon 1//You can disable SELinux protection for the ftpd daemon<你可以让SElinux停止保护vsftpd的daemon方式动行> setsebool -P ftpd_disable_trans 1

 2、httpd

//If you want a particular domain to write to the public_content_rw_t domain <如果希望具体个doman具有可写权限的话,需要设置> setsebool -P allow_httpd_anon_write=1 or setsebool -P allow_httpd_sys__anon_write=1//httpd can be setup to allow cgi s to be executed <HTTP被设置允许cgi的设置> setsebool -P httpd_enable_cgi 1//If you want to allow access to users home directories<允许用户HHTP访问其家目录,该设定限仅于用户的家目录主页> setsebool -P httpd_enable_homedirs 1 chcon -R -t httpd_sys_content_t ~user/public_html//httpd is allowed access to the controling terminal<允许httpd访问终端> setsebool -P httpd_tty_comm 1//such that one httpd service can not interfere with another setsebool -P httpd_unified 0//loadable modules run under the same context as httpd setsebool -P httpd_builtin_ing 0//httpd s are allowed to connect out to the network setsebool -P httpd_can_network_connect 1// You can disable suexec transition setsebool -P httpd_suexec_disable_trans 1//You can disable SELinux protection for the httpd daemon by executing <关闭Selinux的关于httpd进程守护的保护> setsebool -P httpd_disable_trans 1 service httpd restart

3、named

//If you want to have named update the master zone files <关于named,master更新selinux设定> setsebool -P named_write_master_zones 1//You can disable SELinux protection for the named daemon by executing <关闭named的进程守护保护> setsebool -P named_disable_trans 1 service named restart

4、nfs

//If you want to setup this machine to share nfs partitions read only <Selinux将本机的NFS共享设置成只读> setsebool -P nfs_export_all_ro 1//If you want to share files read/write<Selinux将本机的NFS共享设置成可读可写> setsebool -P nfs_export_all_rw 1//If you want to use a remote NFS server for the home directories on this machine <如果你想要将远程NFS的家目录共享到本机,需要开启> setsebool -P use_nfs_home_dirs 1

5、samba

//If you want to share files other than home directorie <如果你希望将目录共享给其他用户,你需要设置> chcon -t samba_share_t /directory//If you want to share files with multiple domains 如果samba服务器共享目录给多个域,则需要: setsebool -P allow_smbd_anon_write=1//If you are setting up this machine as a Samba server and wish to share the home directories samba服务器要共享家目录时: setsebool -P samba_enable_home_dirs 1//If you want to use a remote Samba server for the home directories on this machine 如果你需在本机上使用远程samba服务器的家目录 setsebool -P use_samba_home_dirs 1//You can disable SELinux protection for the samba daemon by executing 关闭selinux关于samba的进程守护的保护 setsebool -P smbd_disable_trans 1 service smb restart

6、rsync

//If you want to share files using the rsync daemon 共享rsync目录时: chcon -t public_content_t /directories//If you want to share files with multiple domains 允许其他用户写入时 setsebool -P allow_rsync_anon_write=1//You can disable SELinux protection for the rsync daemon by executing 停止rsync的进程保护 setsebool -P rsync_disable_trans 1

7、kerberos

//allow your system to work properly in a Kerberos environment 允许系统使用kerberos setsebool -P allow_kerberos 1//If you are running Kerberos daemons kadmind or krb5kdc setsebool -P krb5kdc_disable_trans 1 service krb5kdc restart setsebool -P kadmind_disable_trans 1 service kadmind restart

8、nis

Allow your system to work properly in a NIS environment 
系统工作在nis环境时 

 

setsebool -P allow_ypbind 1

 


    你可能想看:

    扫描二维码推送至手机访问。

    版权声明:本文由皇冠云发布,如需转载请注明出处。

    本文链接:https://www.idchg.com/info/25694.html

    分享给朋友:

    “Linux 操作couchbase命令 linux chcon” 的相关文章

    如何在Linux中指定DNS服务器设置教程

    在开始讨论如何在Linux系统中指定DNS之前,我们需要明白DNS服务器的作用与重要性。DNS,全称域名系统,是将人类易读的域名转换为计算机能够理解的IP地址的系统。想象一下,如果没有DNS,我们每次访问一个网站都得记住复杂的数字IP地址,那将是多么麻烦的一件事。因此,选择一个合适的DNS服务器,不...

    HostYun:高性价比VPS服务的理想选择

    HostYun,最早被称作主机分享,成立于2008年,专注于提供性价比极高的VPS服务。在众多IDC品牌中,HostYun凭借其低价策略迅速占领了一席之地。作为一个以KVM和XEN虚拟化技术为基础的平台,HostYun不仅满足了用户对低成本服务的需求,也为学习、测试和小型项目的部署提供了理想的选择。...

    Vultr Cloud Computer与High Frequency服务器的全面对比

    在云服务的世界中,Vultr无疑是一个备受瞩目的名字。它提供两种主要的云服务器类型:Vultr Cloud Compute和High Frequency服务器。这两种服务器各有其独特之处,适合不同类型的用户和使用场景。 首先,Vultr Cloud Compute是其最基础的产品,主要以高性价比为卖...

    自己搭建网站的全面指南:从目标定位到费用控制

    搭建自己的网站听起来可能有些复杂,但实际上,只要理清思路,完全可以实现。首先,明确你的目标和网站类型是关键的一步。是想建立一个个人博客,还是一个商业网站?这将直接影响你后续的选择和设计。例如,个人博客强调内容,商业网站则需要更多的功能性和用户友好性。所以在开始之前,先问问自己这个网站的核心目的是什么...

    如何选择便宜的海外服务器来提升业务效率

    什么是海外服务器 海外服务器简单来说,就是在国外数据中心托管的服务器。那些需要在国外提供服务和访问的企业或者个人,会选择这种类型的服务器。比起本地服务器,海外服务器往往能提供更好的网络速度和稳定性,尤其是对某些特定的地区来说。如果你有过在网上购物或者访问国际网站的经历,或许你会发现他们的响应速度比一...

    中转机:提升航班灵活性与旅行体验的最佳选择

    中转机的基本定义 中转机,是在航空运输中大量使用的一种方式。简单来说,就是乘客在一段航程中需要在特定的中转站停留,然后再继续前往他们的最终目的地。这个过程中,乘客的航空器可能会更换,或者在中转站转机的时间不同。中转机的作用主要体现在提高航班的灵活性与覆盖范围上。 我想起了自己那次在国外旅行时的经历。...