
Display privileges for another user with sudo command Use sudo to run command as a different user Don’t forget to provide us with your valuable feedback in our comment section. Till then stay tuned and connected to Tecmint. I’ll be here again with another Interesting article. To add an user (bob) to sudo just run the below command as root. Some Linux distributions have “ sudo” enabled by default while most of the distros of today needs you to enable it as a Security Measure. “ sudo” provides you a robust and safe environment with loads of flexibility as compared to ‘ su‘.
Su vs sudo password#
Suggested Read: Let Sudo Insult You When You Enter Incorrect Password Here the user ‘ adam‘ can execute all the commands aliased under “ PROCS”, without entering password. We can execute a ‘ sudo‘ command without entering password by using ‘ NOPASSWD‘ flag. How about executing a ‘ sudo‘ command without entering password? It is possible to specify a System Groups, in place of users, that belongs to that group just suffixing ‘ %’ as below: %apacheadmin WEBSERVERS=(www) APACHE User_Alias WEBMASTER=henry,mark WEBMASTERS WEBSERVERS=(www) APACHEĬmnd_Alias PROC=/bin/kill,/bin/killall, /usr/bin/top Aliases! Yeah the Linux utility where a long-lengthy command or a list of command can be referred as a small and easy keyword.Ī few a lias Examples, which can be used in place of entry in ‘ sudo‘ configuration file. If this list of command varies to the range, where it is literally not possible to type each command manually we need to use aliases. If the number of commands, user is supposed to run is under 10, we can place all the commands alongside, with white space in between them, as shown below: mark beta.database_=(cat) /usr/bin/command1 /usr/sbin/command2 /usr/sbin/command3. What if the user needs to be granted several commands? To implement the above situation, we can write ‘sudo’ as: mark beta.database_=(cat) dog You have a sudo user ‘ cat‘ which is supposed to run command ‘ dog‘ only. Q2.You have a user ‘ tom‘ which is supposed to execute system command as user other than root on the same Database Server, above Explained.įor the above situation the ‘ sudo‘ line can be written as: mark beta.database_=(tom) ALL You are supposed to provide him all the access on Database Server ( beta.database_) only, and not on any host.įor the above situation the ‘ sudo‘ line can be written as: mark beta.database_=(ALL) ALL You have a user mark which is a Database Administrator. Some of the Situations, and their corresponding ‘ sudo‘ line: Suggested Read: 10 Useful Sudoers Configurations for Setting ‘sudo’ in Linux

$ sudo /usr/sbin/visudoĪ screen shot of ‘ /usr/sbin/visudo‘ file, looks something like this: We can run ‘ /usr/sbin/visudo‘ to add/remove the list of users who can execute ‘ sudo‘.
