Linux Basics: User and Group Management

Add User

$ useradd student

Switching user:

$su - student

switch to root:

$ su -

set/change password for user 'student':

$ passwd student

remove password:

$ passwd -d student

Let's make student’s account password expire on 09/15/97:

$usermod -e 09/15/97 student

Delete User:
$userdel student

create a 'sales' group and add 'student' as member and removing 'student' from the 'sales' group:

$ groupadd sales
$ gpasswd sales                     -Assign password
$ gpasswd -r sales                   -Remove password
$ usermod -G sales student
$ gpasswd -d student sales

Default user accounts DB: 
$ vi /etc/passwd

stores password in encryptes form:
$ vi /etc/shadow

Default Group Members accounts DB:
$vi /etc/group

Group Password strore in encryptes form:
$vi /etc/gshadow

Set file permission: 

Ownership: (User , Group, Others) rwx rwx rwx
Permissions: 4 = read (r) 2 = write (w) 1 = execute (x) 0 = no permission (-)

$ chmod 755 test.txt


Most Viewed Post

solution for facebook waiting

Connect Sony XPLOD MEX-BT2500 Bluetooth CD Receiver with ur mobile

Crystal Report : Show data horizontally (Left to right) i.e. columns as rows