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:
$ ps
PID TTY TIME CMD
1413558 pts/3 00:00:00 bash
1413640 pts/3 00:00:00 ps
$
If you're using bash, you can tell your current bash shell invocation to do that with the alias
command:
$ wg
Unable to access interface wg0: Operation not permitted
$ alias wg='sudo wg'
$ wg
interface: wg0...
If you want that command run in every bash shell you invoke, you can do so by editing ~/.bashrc
and adding the line:
alias wg='sudo wg'