0

I am trying to add my user to the www-data group in order to be able to edit the files there without admin rights. This is the command I have used to do that:

$ sudo usermod -aG www-data n_user

$ groups
n_user adm cdrom sudo dip plugdev lxd lpadmin sambashare

$ id
uid=1000(n_user) gid=1000(n_user) groups=1000(n_user),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),111(lxd),115(lpadmin),116(sambashare)


$ grep www-data /etc/group
www-data:x:33:n_user

$ ll /var/www/html/index.html
-rw-rwSr-- 1 www-data www-data  5129 Feb 18 14:21 index.html

$ ll /var/www
total 4.0K
drwxrwSr-x 5 www-data www-data 4.0K Feb 18 13:47 html/

So according to me, this should be sufficient, the problem is that when I try to edit the index.html file, I am still getting a notification that this file is read-only and that I cannot change it without sudo rights.

On top of that, I don't see that my user n_user really belongs to the www-data group with GID: 33. But the grep command is showing me that I am a member, so I am really confused.

What am I doing wrong, and since the file and the folder this file belongs to are both writable by www-data group to which my user belongs, why I cannot really do any changes, without using sudo?

1
  • you can also use newgrp - groupname in your case newgrp - www-data – nobody Mar 12 '20 at 16:35
3

Maybe you need to logout/log back in first? You can check this by executing groups once again after loggin in.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.