Password-less sudo

While never a good idea to enable this in a production, or multi-user system, on a lab system, not needing to type in a password when running sudo makes life a lot easier.

  • To enable password-less sudo:

    sudo visudo
    
  • Add this to the bottom of the file, assuming your username is tom:

    tom ALL=(ALL) NOPASSWD: ALL
    
  • If we wanted to add a group, instead of a user:

    docker ALL=(ALL) NOPASSWD: ALL
    

    This example would allow any user for the docker group to run sudo without a password.

  • If we wanted the user tom to be able to run apt without a password:

    tom ALL=(ALL) NOPASSWD: /usr/bin/apt
    

References

Man pages - sudo https://man7.org/linux/man-pages/man8/sudo.8.html

sudo - visudo manual https://www.sudo.ws/man/1.8.13/visudo.man.html