Thursday 28 January 2016

Unix questions and answers for Root user

Unix questions and answers for Root user

Question: How to login as super admin?
Once you login in console, the root account is not active by default.
To be active as super admin, you need to execute following commands.
sudo -su root



Question: How to change the permission of folder?
chmod 755 folder 



Question: How to change the permission of multiple folder?
chmod 755 foldername1 foldername2 foldername2


Question: How to change the permission of folder in Recursive?
chmod -R 755 folder 



Question: How to change the ownership of folder?
sudo chown user:group foldername



Question: How to change the ownership of multiple folder?
sudo chown user:group foldername1 foldername2 foldername2


Question: How to change the ownership of folder in Recursive?
sudo chown -R user:group foldername



Question: How to change the folder permission only not files?
find . -type d -exec chmod 751 {} \;



Question: How to change the folder permission only in Recursive not files?
find . -type d -exec chmod -R 751 {} \;



Question: Who is login is ssh?
whoami



Question: How to change the password of user?
passwd username
(Now it will prompt for new password and re-enter password)


Question: Give example of understanding from 0-7?
Number Read (R) Write (W) Execute (X)
0 No No No
1 No No Yes
2 No Yes No
3 No Yes Yes
4 Yes No No
5 Yes No Yes
6 Yes Yes No
7 Yes Yes Yes