Sudo 時不需輸入密碼

ref.

sudo 時不需輸入密碼

  1. Backup your /etc/sudoers file by typing the following command:
sudo cp /etc/sudoers /root/sudoers.bak
  1. Edit the /etc/sudoers file by typing the visudo command:
sudo visudo
  1. Append the following entry to run ALL command without a password for a user named cola:
    e.g.
cola ALL=(ALL) NOPASSWD:ALL
  1. Save and exit the file.