Linux follows tough rules when it comes to permission. Being a root user or sudo user gives you permission to do almost anything which normal user don’t have. Several commands need sudo keyword to run and each time you try to run sudo, Linux asks for a password, today we will configure a passwordless sudo.
Step 1: We need to edit the sudoers file we can use command.
$ sudo gedit /etc/sudoers
this will open a document
Step 2: Edit “ALL=(ALL) NOPASSWD: ALL” with username below the line includedir /etc/sudoers.d
>> username ALL=(ALL) NOPASSWD:ALL
here, the username is your username for which you want to configure passwordless sudo
Step 3: get the current username , use command
$ echo "$USER"
Step 4: Edit file with username and save it
Step 5: Try using sudo command
$ sudo apt update
and done, now you can use sudo without any password