Linux, Why can't I write even though I have group permissions?

前端 未结 6 1571
醉酒成梦
醉酒成梦 2021-01-30 12:30

I want to create a file in a directory owned by the staff group which I am a member of. Why can I not do this?

bmccann@bmccann-htpc:~$ ls -l /usr/local/lib/R/
t         


        
6条回答
  •  耶瑟儿~
    2021-01-30 12:59

    I had the same issue, check if the folder has any more ACL rules or not!

    If you can see + (plus sign) when you list folder, that means it has special access rules. For example:

    [user_in_apache_group@web02 html]$ ls -l
    total 16
    drwxrwxr-x  16 apache apache 4096 Sep  4 13:46 ilias
    drwxrwxr-x+ 15 apache apache 4096 Sep  4 13:46 ilias5
    

    View the permission:

    [user_in_apache_group@web02 html] getfacl ilias5
    # file: ilias5
    # owner: apache
    # group: apache
    user::rwx
    user:user_in_apache_group:r-x
    group::rwx
    mask::rwx
    other::r-x
    

    So that means my user (user_in_apache_group) has no write permission for that folder.

    The solution is what @techtonik said, add write permission for user:

    [user_in_apache_group@web02 html]$ sudo setfacl -m u:user_in_apache_group:rwx ./ilias5
    

    Check permission again:

    [user_in_apache_group@web02 html] getfacl ilias5
    ...
    user:user_in_apache_group:rwx
    ...
    

    Hope it helps. ;)

提交回复
热议问题