Friday 20 December 2019

ubuntu - Linux Group Permissions not being enforced correctly.


I am running Ubuntu 10.04 server and am having some very counter-intuitive experiences with users/groups. For example:


sudo touch test_file                    # create empty file

sudo groupadd test # create 'test' group

sudo chown root:test test_file # change group of file to 'test'

sudo chmod g+rwx test_file # give write permissions to group

sudo usermod -a -G test {my-user} # add my user to 'test' group

touch test_file # touch the file as my current user

The last line produces a permissions error.


I have ensured that my user is part of the 'test' group (groups {my-user} confirms this). The group of test_file is also definitely set to 'test' and the group permissions are set.


Why can't my user write to the file test file?



Answer



When adding a user to a new group, that won't be applied in any currently-running processes, only new ones. You need to log out and then log back in.


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...