Want to create an user who will have access to some specific commands

June 18, 2017 344 views
Linux Commands CentOS

I want to create an user who will have access to some particular commands only. Actually there are some guys in my company who does not have any knowledge on linux but i need to give them access to server so that they can execute some particular commands (like ping, mtr etc.) beside these i don't want them to execute any other single commands. So basically i want to create an user who can execute 2/3 specific commands from thousands of commands and that's it. Please help. N.B. I am talking about configuring sudoers file as because i don't need them to run any sudo commands.

1 comment
2 Answers

@zahedjoy009

As a general warning, I would say that if you don't trust users enough to not run commands that may affect the system, whether it's due to them not knowing what those commands do, or not knowing enough about linux in general, I wouldn't add them to the sudo group.

The reason for this is because sudo is the equivalent of root once authenticated. If root can run a command, a sudo user can too as long as they escalate.

There's also cases where even by limiting a command, they can get around it (as is the case in most scenarios, not just with sudo).

For example, let's say a sudo user bypasses the standard sudo limit and simply becomes root, in such a case, limiting their commands will fail as they can simply modify the same file you are, remove the limitations, and do as they wish.

Have another answer? Share your knowledge.