I added group using the command in terminal as,
$ sudo addgroup XXX
And I add user under that group,
$ sudo adduser --ingroup XXX YYY
Now, I need to remove the same group as well as user(s), how to do?
You have to run sudo deluser <username> <groupname>
to delete a user from it's corresponding group. And run this sudo deluser --group <group name>
command to delete a group.
sudo deluser <username> <groupname>
doesn't delete the user, but rather only removes it from <groupname>
. This, indeed, cannot happen if <groupname>
is the primary group of <username>
(e.g., when <username>
was created with adduser <username>
). Instead, sudo deluser <username>
will delete the user completely (naturally removing it from all groups), and also delete the group <groupname>
if <username>
was its only member. Otherwise, sudo deluser --group <group name>
will indeed be needed to delete the group as well.
– Jonathan Y.
Jan 08 '15 at 10:50
deluser <username> <groupname>
anddeluser --group <group name>
– Avinash Raj May 03 '14 at 09:06You may not remove the user from their primary group.
error for me. – Avinash Raj May 03 '14 at 09:23ram
and username asravi
– Avinash Raj May 03 '14 at 09:26