0

Sometime ago for who knows which testing purposes I added www-data to a group of developers called devs. I want to remove it now but it don't let me with the following message:

$ sudo deluser www-data devs
/usr/sbin/deluser: The user `wwww-data' does not exist.

However, it does exist:

$ cat /etc/passwd | grep www-data
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin

and it certainly belongs to the group:

$ cat /etc/group | grep devs
devs:x:1004:www-data,other_user

I could of course edit the file manually but, what is going on?

PD: Ubuntu 14.04.

2 Answers 2

2
$ sudo deluser www-data devs
/usr/sbin/deluser: The user `wwww-data' does not exist.

The error lists the user with 4 Ws instead of 3. Is this a typo or a clue?

1
  • A typo because of my stupidity. I was trying to remove wwww-data which certainly doesn't exists (and I haven't copy-pasted the commands, just the error message).
    – ABu
    Apr 4, 2019 at 18:27
0

Run the command:

groups www-data

If the first item there is "www-data" followed by dev, then you simply need to use the command

usermod -G www-data www-data

This will remove www-data from all groups except www-data which is it's primary.

If the first item is not www-data and is in fact devs, you will need to run the command:

usermod -g www-data www-data

This will move the user www-data to the group www-data and out of devs. If there are any leftover groups after this command, you can run the first usermod command to drop other group associations.

EDIT: If you want to use userdel for this operation, you will need to make sure that devs is not the primary group for the www-data account. If it is you will need to use the usermod -g command to change the primary group as you cannot remove the primary group for an account.

2
  • 1
    No, what I wrote is to remove www-data from group devs. That syntax is shown in the man page.
    – ABu
    Apr 4, 2019 at 20:00
  • Updated my answer as I misunderstood the issue. If your worry is that deluser is not working, can you post the error you get when using the command? The only error we see is the "wwww-data" does not exist one. Apr 4, 2019 at 20:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .