Linux System AdminΒΆ

A user has a username, primary group and additional group.

/etc/passwd Contains one line for each user account. /etc/shadow Contains the password information in encrypted formatfor the system’s accounts and optional account aging information. /etc/group Defines the groups on the system. /etc/default/useradd This file contains a value for the default group, if none is specified by the useradd command. /etc/login.defs This file defines the site-specific configuration for the shadow password suite stored in /etc/shadow file.

Task Format Example -  
Add user to existing or new group useradd -G <group> <user>    
Add User to Primary Group useradd -g <group> <user>    
Add group groupadd <group>    
Set user password passwd <user>``    
Add User to Existing Group as secondary group usermod -a -G <group> <user> usermod -a -G <group> <user> Group can be a list of multiple groups

Add User as Sudo:

su
visudo

Add the user uname to the sudo group, this will permit them to sudo.:

usermod -a -G sudo uname

View Groups:

cat /etc/group

Get info on user:

id <username>