Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

The following will allow newuser to run any commands anywhere? How can I prevent it by allowing the user to run certain commands only?

visudo

## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
newuser ALL=(ALL)       ALL
share|improve this question

2 Answers 2

up vote 5 down vote accepted

You can create a command alias for newuser e.g.

Cmnd_Alias    NEWUSER_CMDS = /path/to/cmd1, /path/to/cmd2, /path/to/cmd3

then use that as part of the user specification

newuser ALL=(ALL) NEWUSER_CMDS 
share|improve this answer
    
On Ubuntu/Debian systems specifically, I noticed the notation: newuser ALL=(ALL:ALL) NEWUSER_CMDS This looks like the way SUDO users are defined on that platform through the VISUDO command. Does Fedora support this as well? –  Richard Pascual Oct 1 at 0:17
newuser ALL=(ALL)       /path/to/your/command

Read User Specification section in the man sudoers page for more details.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.