Searching for "no sudo password" etc., I found several ways to edit / etc / sudoers
with visudo
, but it didn't work in my environment (Ubuntu 18.04).
A note of the underlying situation and solution.
I edited / etc / sudoers
with visudo
and tried to do sudo
only for certain commands without a password.
But it doesn't work.
Specifically, for example
$ sudo visudo
/etc/sudoers
...
%sudo ALL=(ALL:ALL) ALL
kobalt ALL=(ALL) NOPASSWD: /usr/bin/whoami
...
Even as
$ sudo whoami
[sudo] password for kobalt:
I will be asked for a password.
Instead of using visudo
, create a file under /etc/sudoers.d/
and describe the settings you want to add to it.
$ cd /etc/sudoers.d
$ sudo vim free_whoami
/etc/sudoers.d/free_whoami
kobalt ALL=(ALL) NOPASSWD: /usr/bin/whoami
Then
$ sudo whoami
root #No password required
By the way, I ran into this problem during the process of making the key remapper called xkeysnail start up automatically at startup.
Now it seems that you can move the cursor on Ubuntu without moving from the home position.
Recommended Posts