Introduction
When you install a fresh copy of Debian or Raspbian on your Raspberry Pi you might notice that sudo does not ask for a password. This is a security risk and should be fixed. Let’s see how to fix it.
Fix Sudo not asking Password on Raspberry Pi
This happens due to the NOPASSWD
option for your user. We need to make sure that this option is not set.
We will edit the file named 010_pi-nopasswd
. To find its location we will use the find
command.
This will return the location of the file. In my case it is /etc/sudoers.d/010_pi-nopasswd
. Now we will edit this file using visudo
.
The current content on the file will look like this.
Where <username>
is your username. We need to remove the NOPASSWD
option. So the file will look like this.
Save the file and exit. Now when you run sudo
it will ask for a password.
Conclusion
We looked into how to fix sudo not asking password on Raspberry Pi. This is a security risk and should be fixed. If you have any questions feel free to contact me here.
See you in another one. Bye đź‘‹