Jump to content

Difference between "usermod -aG" and "usermod -G" options in linux?

Go to solution Solved by Guest,

the "-a" in usermod is append and "-G" assigns supplementary groups. https://linux.die.net/man/8/usermod

 

So lets say you have a user named joe and its in groups joe,storage,power. joe would be the primary group of joe.

 

usermod -G wheel joe

joe now belongs to joe,wheel

 

usermod -aG wheel joe

joe now belongs to joe,storage,power,wheel

I'm on centos 7. I'm wondering what could be the differences between these two?

I've read this but could not grasp what they're trying to say. Can you give me an example scenario to work with?

https://unix.stackexchange.com/questions/608822/difference-between-usermod-ag-and-usermod-g-options

 

Link to post
Share on other sites

the "-a" in usermod is append and "-G" assigns supplementary groups. https://linux.die.net/man/8/usermod

 

So lets say you have a user named joe and its in groups joe,storage,power. joe would be the primary group of joe.

 

usermod -G wheel joe

joe now belongs to joe,wheel

 

usermod -aG wheel joe

joe now belongs to joe,storage,power,wheel

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×