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

and it certainly belongs to the group:

$ cat /etc/group | grep devs

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

PD: Ubuntu 14.04.

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

  • 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). – Peregring-lk Apr 4 at 18:27

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.

  • 1
    No, what I wrote is to remove www-data from group devs. That syntax is shown in the man page. – Peregring-lk Apr 4 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. – Alexander Wryn Apr 4 at 20:25

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.