Welcome to the Linux Foundation Forum!

Sudoers: "sudo sudo su" command block

Hi,

I'm working on a task that allows users to run commands with "sudo" but not actually be able to access the root account.

Use commands with "sudo" = ok
I need help blocking sudo usage like this: sudo sudo su
In this format, users can successfully access

Thanks for the help in advance.

Answers

  • I use sudo cat /etc/sudoers to look without making changes, or sudo visudo to make changes. This is what I do to allow scripts to have certain user permissions. For example, if I want Cantata (the best music player in the world) or MPD to have strict permissions or all permissions, I will add that in my sudoers file."
    Key Syntax Tips for Sudoers Configurations
    Granting Specific Binary Access: To allow a user to run a specific command (like mpd or a custom script) with elevated rights without prompting for a password, add a rule like this via visudo:
    twzzler ALL=(ALL) NOPASSWD: /usr/bin/mpd
    Using sudoers.d Drop-in Files: Creating a dedicated file inside /etc/sudoers.d/ (such as /etc/sudoers.d/cantata_mpd) keeps your custom permission rules separate from the core system file, making them much easier to manage or backup.

Categories

Upcoming Training