Wednesday, August 6, 2014

Allow Regular User To Run Administrative Commands

- To achieve this, one would need to add the users and respective commands to '/etc/sudoers' file.

- Run the command : visudo

- This command would open up '/etc/sudoers' file in edit mode and doesn't allow another user to open the file and edit in any other terminal.

- Say for example, we'd need to allow user 'bkp' to run the 'mke2fs' command then we could add the below line in '/etc/sudoers' to accomplish this task:

bkp    ALL=/sbin/mke2fs

- After this change, the user 'bkp' would need to run the command with 'sudo' as given below:

 $ sudo /sbin/mke2fs -n /dev/sdb1

   << this would prompt for password, so after successful authentication, it would run the   administrative command by the user bkp >>

- Other users except 'root' cannot execute commands under /sbin


CertDepot said...

It seems that there is something wrong with the title: wouldn't you mean "allow regular user to run administrative commands" instead of "allow regular user to tun administrative commands"?

My OCP4 Project said...

Thanks CertDepot!. I fixed the heading of the post. Thanks again!
Sadashiva Murthy M[]