Sunday 24 June 2018

How to Create Group and User in Linux 7.2

https://dbissues.blogspot.com/2018/06/how-to-create-group-and-user-in-linux-72.html


1:  Command to create user.
useradd   -r  shafqat

2:) Command to create  group.
groupadd  dba

3:) Command to assign  group to a user.
usermod  -a  -G  dba  shafqat

4:) Command to delete group.
groupdel  dba

5:) Command to delete user.
userdel   shafqat


Change a User’s Primary Group
Sometimes you might want to switch out the primary group that a user is assigned to, which you can do with this command:
usermod -g <groupname> username
You need to the useradd command to add new users to existing group (or create a new group and then add user). If group does not exist, create it. The syntax is as follows:
useradd -G {group-name} username

No comments:

Post a Comment