9

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 sudo

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

Dave
  • 2,095
  • 7
  • 21
  • 33

3 Answers3

7

your command is good. you can check the group with

getent group | grep davea

if your user are in group www-data, you just have to relog your user davea.

regards

JYWY
  • 121
6

You need to log off and on the davea user to see that davea is a member of www-data group.

Pilot6
  • 90,100
  • 91
  • 213
  • 324
2

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.

nobody
  • 5,437