【busybox记录】【shell指令】chcon

目录

内容来源:

【GUN】【chcon】指令介绍

【busybox】【chcon】指令介绍

【linux】【chcon】指令介绍

使用示例:

常用组合指令:

指令不常用/组合用法还需继续挖掘:


内容来源:

        GUN : Coreutils - GNU core utilities

        busybox v1.36.1 : 【busybox记录】【shell指令】基于的Busybox的版本和下载方式-CSDN博客

【GUN】【chcon】指令介绍

chcon:更改文件的SELinux上下文
chcon 更改所选文件的SELinux安全上下文。
简介:
chcon [option]... context file...
chcon [option]... [-u user] [-r role] [-l range] [-t type] file...
chcon [option]... --reference=rfile file...
将每个文件的SELinux安全上下文更改为 context。使用 --reference,将每个文件的安全上下文更改为 rfile的安全上下文。
程序接受以下选项。请参见第2章[常用选项],第2页。
‘--dereference’
	不要影响符号链接,而是影响它们所指的内容;这是默认值。
‘-h’
‘--no-dereference’
	影响符号链接本身,而不是任何引用的文件。
‘--reference=rfile’
	使用rfile的安全上下文,而不是指定上下文值。
‘-R’
‘--recursive’
	递归地操作文件和目录。
‘--preserve-root’
	当与 --recursive选项一起使用时,拒绝对根目录/进行递归操作。参见第9页第2.9节[治疗/特别治疗]。
‘--no-preserve-root’
	不要处理根目录/,特别是在递归操作时;这是默认值。参见第9页第2.9节[治疗/特别治疗]。
‘-H’ 
	如果指定了 --recursive (-R),并且命令行参数是指向目录的符号链接,则遍历它。参见第2.8节[遍历符号链接],第9页。
‘-L’ 
	在递归遍历中,遍历遇到的每个指向目录的符号链接。参见第2.8节[遍历符号链接],第9页。
‘-P’ 
	不要遍历任何符号链接。参见第2.8节[遍历符号链接],第9页。
‘-v’
‘--verbose’
	为处理的每个文件输出诊断。
‘-u user’
‘--user=user’
	在目标安全上下文中设置user user。
‘-r role’
‘--role=role’
	在目标安全上下文中设置role role。
‘-t type’
‘--type=type’
	在目标安全上下文中设置type type。
‘-l range’
‘--range=range’
	在目标安全上下文中设置range range。
退出状态为0表示成功,非0表示失败。

【busybox】【chcon】指令介绍

NA

【linux】【chcon】指令介绍

[root@localhost bin]# chcon --help
用法:  chcon [选项]... 环境 文件...
 或:  chcon [选项]... [-u 用户] [-r 角色] [-l 范围] [-t 类型] 文件...
 或:  chcon [选项]... --reference=参考文件 文件...
Change the SELinux security context of each FILE to CONTEXT.
With --reference, change the security context of each FILE to that of RFILE.

必选参数对长短选项同时适用。
      --dereference      affect the referent of each symbolic link (this is
                         the default), rather than the symbolic link itself
  -h, --no-dereference   affect symbolic links instead of any referenced file
  -u, --user=USER        set user USER in the target security context
  -r, --role=ROLE        set role ROLE in the target security context
  -t, --type=TYPE        set type TYPE in the target security context
  -l, --range=RANGE      set range RANGE in the target security context
      --no-preserve-root  do not treat '/' specially (the default)
      --preserve-root    fail to operate recursively on '/'
      --reference=RFILE  use RFILE's security context rather than specifying
                         a CONTEXT value
  -R, --recursive        operate on files and directories recursively
  -v, --verbose          output a diagnostic for every file processed

The following options modify how a hierarchy is traversed when the -R
option is also specified.  If more than one is specified, only the final
one takes effect.

  -H                     if a command line argument is a symbolic link
                         to a directory, traverse it
  -L                     traverse every symbolic link to a directory
                         encountered
  -P                     do not traverse any symbolic links (default)

      --help		显示此帮助信息并退出
      --version		显示版本信息并退出

GNU coreutils 在线帮助:<https://www.gnu.org/software/coreutils/>
请向 <http://translationproject.org/team/zh_CN.html> 报告 chcon 的翻译错误
完整文档请见:<https://www.gnu.org/software/coreutils/chcon>
或者在本地使用:info '(coreutils) chcon invocation'

使用示例:

NA

常用组合指令:

NA

指令不常用/组合用法还需继续挖掘:

  • 8
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

梦幻面条EW

感谢您的打赏

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值