V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
wecan
V2EX  ›  程序员

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

  •  
  •   wecan · 2015-10-10 21:30:19 +08:00 · 1880 次点击
    这是一个创建于 3120 天前的主题,其中的信息可能已经有所发展或是发生改变。
    新手接触 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 条回复    2015-10-25 19:21:18 +08:00
    loveminds
        1
    loveminds  
       2015-10-10 22:08:06 +08:00   ❤️ 1
    应该是在 inode 结构里
    wecan
        2
    wecan  
    OP
       2015-10-10 22:14:21 +08:00
    @loveminds 谢谢~如果删除文件的话, inode 是随文件一起删除的吗?
    rrfeng
        3
    rrfeng  
       2015-10-10 23:00:25 +08:00   ❤️ 1
    SELinux 的 contex
    onlyxuyang
        4
    onlyxuyang  
       2015-10-10 23:50:33 +08:00 via Android   ❤️ 1
    是的 一起删除…… selinux 真是头大啊……
    skydiver
        5
    skydiver  
       2015-10-11 00:15:30 +08:00   ❤️ 1
    man chcon

    chcon - change file SELinux security context

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

    man 应该是第一个学的 linux 命令
    loveminds
        6
    loveminds  
       2015-10-25 19:21:18 +08:00
    @skydiver 不过 man 并不能告诉你各个东西的实现原理
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1002 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 19:41 · PVG 03:41 · LAX 12:41 · JFK 15:41
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.