Having trouble with this question. How can I take "myGroup" and make it have the same GID as a different group, such as sudo, with the GID 27? When I run the following command, Linux says that the GID already exists:
groupmod -g 27 myGroup
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.
Sign up to join this communityHaving trouble with this question. How can I take "myGroup" and make it have the same GID as a different group, such as sudo, with the GID 27? When I run the following command, Linux says that the GID already exists:
groupmod -g 27 myGroup
From man groupmod
:
The value of GID must be a non-negative decimal integer. This value must be unique, unless the -o option is used.
So all you have to do is to add the -o
-option to your command, you will also need root-privileges to run the command:
sudo groupmod -o -g 27 myGroup
I don't know why you want to do this and I can't tell you what the side-effects of doing so are. For me this sounds a bit scary, but you might have a good reason.
The groupmod
has to be used with the --non-unique
command line option to allow for two groups with the same identifier.
You may also edit the /etc/group
file manually.
A group entry look like this:
sudo:x:27:
The "x" is a password placeholder. Passwords are not going to ever appear in the /etc/group
file anymore. Instead they are put in the shadow file.
The first field is the name and the 3rd the number.
The forth field (empty in the example above) is the list of comma separated user names of users in that group.
So for example you could add:
odus:x:27:henri
Note that using such doubly named groups can be tricky. Most software will most certainly not handle it correctly.