Skip to Content
Last repository update 9/13/2025 🎉

Run Sudo Command Without a Password

Learn how to run a sudo command without a password prompt.

karchunt

Kar Chun Tan

Creator

Metadata

Fri Mar 28 2025

1 min read

93 words

Steps to run a sudo command without a password

  1. Open /etc/sudoers with visudo editor, as if straight away edit /etc/sudoers file with text editor, it won’t validate the syntax.

    sudo visudo
  2. Append this line username ALL=(ALL:ALL) NOPASSWD:ALL at the end of the /etc/sudoers file

    /etc/sudoers
    # User privilege specification root ALL=(ALL:ALL) ALL # Members of the admin group may gain root privileges %admin ALL=(ALL) ALL # Allow members of group sudo to execute any command %sudo ALL=(ALL:ALL) ALL # See sudoers(5) for more information on "@include" directives: @includedir /etc/sudoers.d kc ALL=(ALL:ALL) NOPASSWD:ALL
  3. Open a new terminal window and test the command with root privileges

    sudo apt-get update
Last updated on