95

I just did usermod -l login-name old-name to change the username, but the group name is still the old one.

Any way of renaming the group name? I can't find any info to do so.

2 Answers 2

124

groupmod should work fine. Run it as superuser:

# groupmod --help
Usage: groupmod [options] GROUP

Options:
  -g, --gid GID                 change the group ID to GID
  -h, --help                    display this help message and exit
  -n, --new-name NEW_GROUP      change the name to NEW_GROUP
  -o, --non-unique              allow to use a duplicate (non-unique) GID
  -p, --password PASSWORD       change the password to this (encrypted)
                                PASSWORD

Use it like this:

groupmod --new-name NEW_GROUP_NAME OLD_GROUP_NAME

Note that this takes effect immediately and you do not need any logout/login.

3
  • 8
    run it as a superuser
    – KawaiKx
    Jun 30, 2014 at 18:56
  • Does it require a logout, login to take effect, like adding someone to a group does?
    – Jonathan
    May 18, 2018 at 19:13
  • @Jonathan: No, it takes effect immediately. Feb 26, 2019 at 17:48
17

To reNAME as you asked:
sudo groupmod -n new-name current-name

Note: If the name already exists but you want to use it anyway:
sudo groupmod -o -n new-name current-name

If you are root you don't need to use sudo

1
  • To list existing groups. Execute -> groups Jul 12, 2023 at 8:46

You must log in to answer this question.

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