Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Yesterday my user name "carlwill" was a part of 2 groups on this server (RHEL4).
"ctia" & "wheel"
I created a new group on the server called "ctia_admin" with specific read/write access to folders.
I then gave the following command:
Code:
#usermod -G ctia_admin cwilliams
Now I am no longer a member of wheel. I am now a member of ctia & ctia_admin. Why did this command not add a 3rd group rather than replace my wheel group. I could not for the life of me understand why I no longer had sudo access.
I did "man" the usermod page and am still confused.
I am not sure if "adduser" would be good considering the user already exist on the system. I would just be modifying their groups and not adding an entire new person to the system unless I am misunderstanding you...
Sorry about that. I knew there was a different command from usermod that doesn't remove all the preexisting groups, but I gave the wrong one. gpasswd was the one I was thinking of. It's used gpasswd -a <user> <group>
-G group,[...]
A list of supplementary groups which the user is also a member
of. Each group is separated from the next by a comma, with no
intervening whitespace. The groups are subject to the same
restrictions as the group given with the -g option. If the
user is currently a member of a group which is not listed, the
user will be removed from the group
you need to list all of the groups(wheel,ctia,etc) for that user in usermod -G parameters, and put the user's initial group with -g parameter
gpasswd would be gpasswd -a cwilliams ctia_admin for what you originally wanted, just adding the group. Since now you're just missing wheel it would be gpasswd -a cwilliams wheel.
As for directly editing the files, I don't remember the syntax and I'm currently on windows and trying to figure out how to get my wireless working on Linux so I'm not much help right now.
So just to avoid confusion, can you post an example of how this scenario would look.
User = Jim
Group(s) = ctia wheel
Jim needs to also be a member of admin so in total Jim will be a member of ctia wheel admin
How would this command look?
usermod -g admin -G admin,ctia,wheel Jim
with admin as the initial group, ctia and wheel supplementary groups
Jim will be a member of admin,ctia and wheel
you can check it by using id command, or groups command (as Jim)
files to edit are /etc/passwd(note the GID there) and /etc/group
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.