sudo user and special permission

 deleting of user:-

*****************


#userdel <username>   --> to delete a user without deleting his home dir

ex: #userdel maa


#userdel -r <username>  --> to delete a user with its home dir

ex: #userdel -r tokyo



creating  a sudo user:-

**********************

-> the main purpose of creating a sudo user is to give a restricted permissions of root user to normal user


-> all the details of sudo user are stored in /etc/sudoers file


#vim /etc/sudoers


locate the line number 100 and add the entry in next line



<username> ALL=(ALL) <binary path of command>

ex: zafar ALL=(ALL) NOPASSWD:/usr/sbin/useradd

    suhaib ALL=(ALL) ALL


-> for groups if u want to give a sudo permission then go to 107 line and add the entry in next line


%<group name> ALL=(ALL) <binary path of  command>

%kxip ALL=(ALL) NOPASSWD:/usr/sbin/useradd


:wq!



--> to know the binary file path of a command is 


#which <command>  

ex: #which useradd


/usr/sbin/useradd




#su - zafar


$ useradd <username>   --> you get an error permission denied


$ sudo useradd <username>  --> to execute as a sudo user

ex: $ sudo useradd zohra


special permissions:-

********************

-> we have 3 special permissions in linux OS:


1) SUID  (set user ID)

2) SGID (set group ID)

3) sticky bit 



SUID:-

*****

-> it is used to assign root user permmission to all normal users

-> if as a normal user we give root user commands it error as permission denied

-> apply SUID permission for perticular commands binary file

-> numerical value of SUID is "2"


to apply:-

*********

#which <command>   -> to know the binary file path of command

ex: #which useradd

/usr/sbin/useradd



#chmod u+s  <binary file path>

ex: #chmod u+s  /usr/sbin/useradd


#su - red


$useradd papa


#chmod u-s <binary file path>   --> removing a SUID permission on a perticular commands binary file

ex: #chmod u-s /usr/sbin/useradd


















Comments

Popular posts from this blog

AIX migration using alt_disk method

HMC - List the Port VLAN IDs and Additional VLAN IDs ( tagged ) associated with the NICs of a LPAR.