Question

SUDOERS PERMISSIONS | RESTRICT COMMANDS

I want to restrict certain commands to certain users that are sudoers, for example:

john ALL=ALL,!/usr/bin/apt-get #john won’t be able to run apt-get

My question comes when john can use cp, mv or ln to copy and change the name of the binary, for example:

john home$ sudo ln -s /usr/bin/apt-get myaptget

This renders my sudoers file configuration useless.

Any suggestions, plugin/app to restrict and differentiate sudoers/permissions?

Imagine I have 2 administrators on my system, but I’d like that one of them to have more control than the other…

Thank you very much for your answers, best regards!


Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi @L0rdSergio,

I’m not sure you’ll be able to execute the myaptget command even if you’ve created the symlink. Have you tried it, does it work?

As for the 2 administrators, you’ll just need to create two different groups which are sudoers or just have some different level of access in terms of commands and assign the administrators to whichever group you need them to be.

I’ll recommend giving the following tutorial a read, I think it will be useful:

https://www.digitalocean.com/community/tutorials/how-to-edit-the-sudoers-file