Setting Up SUDO

[problem]

You want to allow a user to run one command, as root user.

[/problem]

[solution]

To allow a user access to run stuff as root, just login as root and then add the following line to /etc/sudoers.


userid hostname=command

[/solution]

[example]

For example to allow user marcus access on bree, to restart, stop, start or check apache:


marcus bree=/etc/init.d/httpd

To allow all access on all boxes:


marcus (ALL)=(ALL)

[/example]

[reference]

[tags]sudo, switch user do, temporary UNIX authorisation, Unix Coding School[/tags]

[/reference]

If you have found my website useful, please consider buying me a coffee below 😉

Leave a Reply

Your email address will not be published. Required fields are marked *