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

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.


Have you tried “jail” ?

Here is a hint, about it…

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.


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.