• 请不要在回答技术问题时复制粘贴 AI 生成的内容
wecan
V2EX  ›  程序员

chcon 命令实际上做了什么事情呢

  •  
  •   wecan · Oct 10, 2015 · 2308 views
    This topic created in 3878 days ago, the information mentioned may be changed or developed.
    新手接触 CentOS ,请教各位大神,当我输入:

    chcon -t samba_share_t ~/Install/

    的时候,系统到底做了什么?这个命令修改的“ security context ”到底是什么东西呢?

    是文件属性(e.g., 777,755)吗,如果是的话,一样也要执行 chmod 来改变文件属性。

    如果说 linux 是以文件为基础的操作系统的话,这个 security context 是否也是一个文件?比如像注册表文件之类的东西(在某个地方有一个文件列出了所有被修改的 security context )。

    如果当我 rm -rf ~/Install/ 的时候,这个 security context 也就一起销毁了吗。。

    非常感谢!
    6 replies    2015-10-25 19:21:18 +08:00
    loveminds
        1
    loveminds  
       Oct 10, 2015   ❤️ 1
    应该是在 inode 结构里
    wecan
        2
    wecan  
    OP
       Oct 10, 2015
    @loveminds 谢谢~如果删除文件的话, inode 是随文件一起删除的吗?
    rrfeng
        3
    rrfeng  
       Oct 10, 2015   ❤️ 1
    SELinux 的 contex
    onlyxuyang
        4
    onlyxuyang  
       Oct 10, 2015 via Android   ❤️ 1
    是的 一起删除…… selinux 真是头大啊……
    skydiver
        5
    skydiver  
       Oct 11, 2015   ❤️ 1
    man chcon

    chcon - change file SELinux security context

    然后再 Google 一下 SELinux 就知道怎么回事了。

    man 应该是第一个学的 linux 命令
    loveminds
        6
    loveminds  
       Oct 25, 2015
    @skydiver 不过 man 并不能告诉你各个东西的实现原理
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1623 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 16:31 · PVG 00:31 · LAX 09:31 · JFK 12:31
    ♥ Do have faith in what you're doing.