groupadd and useradd

Add a group 'friend' with a specific gid 600:
groupadd --gid 600 friend
Create a user with a specific gid 'friend':
useradd -g friend -m username
Add a existing user 'username' to a group 'friend'
usermod -a -G friend username
Change username's primary group to 'friend'
 usermod -g friend username

No comments: