Posts Tagged ‘groupadd’

Add Group/User In Linux

March 27th, 2010

 

Add Group

 

To add group to your system you can do this:

groupadd groupname

or:

groupadd -g xxxx groupname

Where:

-g is switch to add custom GID (group ID) which is numerical (non-negative) value of the group’s ID. This value must be unique, unless the -o option is used. If not stated, GID will be default one (smallest ID value greater than 500 and greater than every other group). Values between 0 and 499 are typically reserved for system accounts

You can find more about this command and its options by running:

man groupadd

 

 

Add User

 

To add user you can simply do this:

useradd username

or:

useradd -c “comment” -g groupname -m -s shell username

Where:

-c is switch to add custom comment. If not stated, no comment will be added to user info
-g is for custom groupname. If not stated, new user will be added to default groupname
-m or –create-home will create user’s home dir if it is not already created and files and folders contained in SKEL_DIR (usualy /etc/skel) will be copied there (unless -k option is prompted)
-s is shell option. You can find shell type binaries in /bin dir (i.e.: /bin/bash, /bin/tcsh, /bin/sh, etc.). If not stated, system will select the default shell

You can find out more about this command and its options by running:

man useradd