Monday, March 17, 2014

PERMISSIONS

 permissions on directory and on file

[root@localhost Desktop]# mkdir /india

[root@localhost /]# ls -ld india
drwxr-xr-x. 2 root root 4096 Mar 17 14:13 india

[root@localhost Desktop]# cd /india
[root@localhost india]# ls
[root@localhost india]# whoami
root
[root@localhost india]# touch ap
[root@localhost india]# ls -ld ap
-rw-r--r--. 1 root root 0 Mar 17 14:13 ap

Saturday, March 15, 2014

ADD & REMOVE USERS IN A GROUP

[root@localhost /]# useradd os1
[root@localhost /]# useradd os2
[root@localhost /]# useradd os3

[root@localhost /]# gpasswd -M os1,os2,os3 soft

[root@localhost /]# grep soft /etc/group
soft:x:504:os1,os2,os3

[root@localhost /]# gpasswd -d os1 soft
Removing user os1 from group soft

[root@localhost /]# grep soft /etc/group
soft:x:504:os2,os3

CHANGING THE NAME OF A EXISTING GROUP


[root@localhost /]# groupmod -n soft sales

[root@localhost /]# grep soft  /etc/group
soft:x:504:

ADDING NEW GROUP WITH GID 600 & MODIFYING GROUP GID

to add new group gid

[root@localhost /]# groupadd -g 600 market

[root@localhost /]# grep market  /etc/group
market:x:600:

 modifying group gid

[root@localhost /]# groupmod -g 640 market

[root@localhost /]# grep market  /etc/group
market:x:640:

ADD NEW GROUP

add the group

[root@localhost /]# groupadd sales

to check the group

[root@localhost /]# grep sales /etc/group
sales:x:504:

REMOVE USER

remove user with out home directory


[root@localhost /]# userdel sys1

remove user with directory

[root@localhost /]# userdel -r sys4

USER ACCOUNT LOCK AND UNLOCK


[root@localhost /]# passwd sys4
Changing password for user sys4.
New password:
BAD PASSWORD: it is based on a dictionary word
Retype new password:
passwd: all authentication tokens updated successfully.

[root@localhost /]# usermod -L sys4

[root@localhost /]# usermod -U sys4