I would like to set a specific command to not require sudo privileges, is there a way to accomplish this? I know you can add commands to the sudoer file to allow certain commands to be used by non root accounts, so maybe there is something similar for adding commands to allow regular users to use?
So, you mean that you want specific users who don't have "sudo" in their list of supplemental groups in /etc/group to also be able to invoke specific commands with sudo, but not arbitrary ones? Sure, you can do that.
The line in /etc/sudoers in Debian that lets members of group "sudo" run arbitrary commands with "sudo" is this:
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
But you can have individual users in there too. Here's an example of setting a specific user to being able to run the whoami command and apt command as root, without requiring a password to do so:
Well my other comement saying this is exactly what i need did not get posted as a reply to your comment, my mistake. I followed rhe example for "/usr/bin/wg/" intending to be able to use
wg show
but it still requires sudo. I tried rebooting and nothing changed, any ideas? I did
Well my other comement saying this is exactly what i need did not get posted as a reply to your comment, my mistake.
What the line I listed will do will let a specific user have permission to use sudo without a password to run wg as root without a password. So they (and not other users) can type:
$ sudo wg
And the command will run as the root user, without them being prompted to enter a password.
It doesn't mean that when that user runs:
$ wg
In their shell, what will actually run is:
$ sudo wg
If you also want to avoid typing the extra characters, you can set up an alias in your shell.
I don't know what shell you're using, but most Linux systems use bash as a default: