I'm using Ubuntu 18.04. I want to add my user, "davea" to the group "www-data". I tried this
(venv) davea@chicommons-laboratory:/var/www/html/web$ groups
davea sudo
(venv) davea@chicommons-laboratory:/var/www/html/web$ sudo usermod -a -G www-data davea
[sudo] password for davea:
(venv) davea@chicommons-laboratory:/var/www/html/web$ groups
davea sudobut as you can see, even though the command didn't give any errors, my user is still not added to the group. What am I doing wrong?
3 Answers
your command is good. you can check the group with
getent group | grep daveaif your user are in group www-data, you just have to relog your user davea.
regards
You need to log off and on the davea user to see that davea is a member of www-data group.
Or you can use newgrp
From manpage
The newgrp command is used to change the current group ID during a login session. If the optional - flag is given, the user's environment will be reinitialized as though the user had logged in, otherwise the current environment, including current working directory, remains unchanged.
newgrp - www-data I use this in Live-sessions; where you usually you can not logput for reloging.