Can’t Add User Back Again With Adduser – Group Still Exists

Having deleted a Linux user there was a requirement for the user to be created once again.

The gist of the Linux command to add a user called username is:

adduser username

The command will create a new user together with an associated dedicated primary group for that user.

However, when previously using the command deluser to delete the user, the associated group had been left behind.

However, having previously deleted this user, but not its associated group I was presented with an error because the original user specific group had been left in existence and not deleted.

To review the groups, filtered by this user:

less /etc/group | grep username

I wanted to add a user back into a Linux computer. One of the available parameter options for the adduser command is ingroup. ingroup can be used to override the user’s primary group. In this case telling it to assign an existing group, the one which wasn’t deleted previously, to the user as its primary one.

Adduser command used below has the additional ingroup parameter with the associated username group which results in the user’s group override and the settings of the existing, left over, group.

adduser username --ingroup username

If you have deleted a Linux user and subsequently found that you wish to add this user once again, but discover that the group associated with this user was left behind then the use of –ingroup can enable the user to be added one more.