chcon命令详解.docx_第1页
chcon命令详解.docx_第2页
chcon命令详解.docx_第3页
chcon命令详解.docx_第4页
chcon命令详解.docx_第5页
免费预览已结束,剩余1页可下载查看

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

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 directororiessetsebool -P ftp_home_dir 1/If you want to run ftpd as a daemonsetsebool -P ftpd_is_daemon 1/You can disable SELinux protection for the ftpd daemonsetsebool -P ftpd_disable_trans 12、httpd/If you want a particular domain to write to the public_content_rw_t domainsetsebool -P allow_httpd_anon_write=1orsetsebool -P allow_httpd_sys_anon_write=1/httpd can be setup to allow cgi s to be executed setsebool -P httpd_enable_cgi 1/If you want to allow access to users home directoriessetsebool -P httpd_enable_homedirs 1chcon -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 anothersetsebool -P httpd_unified 0/loadable modules run under the same context as httpdsetsebool -P httpd_builtin_ing 0/httpd s are allowed to connect out to the networksetsebool -P httpd_can_network_connect 1/ You can disable suexec transitionsetsebool -P httpd_suexec_disable_trans 1/You can disable SELinux protection for the httpd daemon by executing setsebool -P httpd_disable_trans 1service httpd restart3、named/If you want to have named update the master zone files setsebool -P named_write_master_zones 1/You can disable SELinux protection for the named daemon by executingsetsebool -P named_disable_trans 1service named restart4、nfs/If you want to setup this machine to share nfs partitions read onlysetsebool -P nfs_export_all_ro 1/If you want to share files read/writesetsebool -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 15、samba/If you want to share files other than home directoriechcon -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 directoriessamba服务器要共享家目录时: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 1service smb restart6、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 17、kerberos/allow your system to work properly in a Kerberos environment允许系统使用kerberossetsebool -P allow_kerberos 1/If you are running Kerberos daemons kadmind or krb5kdcsetsebool -P krb5kdc_disable_

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论