This is a one line solution that also changes files permissions as stated in /etc/sudoers.d/README
:
sudo sh -c 'echo "$(logname) ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/$(logname)'&& sudo chmod 440 /etc/sudoers.d/$(logname)
This is a one line solution that also changes files permissions as stated in /etc/sudoers.d/README
:
sudo sh -c 'echo "$(logname) ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers.d/$(logname)'&& sudo chmod 440 /etc/sudoers.d/$(logname)