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

$ 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?

  • you can also use newgrp - groupname in your case newgrp - www-data
    – nobody
    Mar 12, 2020 at 16:35

1 Answer 1


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.