Group member cannot create files/directories in folder

6,452

If the group was just created the user must re-login in order for the group's permissions to be applied.

Expanding on the only other answer:

su -l $USER 

su changes the effective user. -l indicates that we should make this new shell into a login shell $USER is a environment variable which should always be your user. Same results as whoami

P.S. You may wish to re-export your display if you wish to use GUI applications.

export DISPLAY=:0.0

Will work for most people.

Related superuser question

Share:
6,452

Related videos on Youtube

MrSoundless
Author by

MrSoundless

Updated on September 18, 2022

Comments

  • MrSoundless
    MrSoundless over 1 year

    I'm trying to set up my Linux server and I managed to get stuck at this point:

    1. I created a group called 'gitusers' and added a user to it (let's call him 'foo')
    2. I created a folder called 'website'
    3. I set 'gitusers' as the group of 'website' and chmod'ed it to 775
    4. I'm logged in as 'foo' but mkdir just returns a 'permission denied' error

    Q: Why does this happen and how do I solve this?

    Notes:

    I browsed to 'website' and did a ls -al:

    ls -al
    total 8
    drwxrwxr-x. 2 root gitusers 4096 Oct 24 22:39 .
    drwxr-xr-x. 3 root root     4096 Oct 24 22:39 ..
    

    As you can see the current folder's group is 'gitusers'

    But I still get the permission error:

    mkdir test
    mkdir: cannot create directory `test': Permission denied
    
  • studiohack
    studiohack about 9 years
    can you expand on this a bit more? Explain more about what this command does?
  • Frank Nocke
    Frank Nocke about 2 years
    @studiohack You are re-logging in (possibly even as yourself), thus within that prompt you already gain your ‘new group member powers’. (The ones that you truly and fully and globally get only after logout+login)