10

I've put a command sudo do something in my ~/.bashrc, this works but everytime I open the terminal I have to type in my password. How do I make it so there is no password-typing?

3 Answers3

11

You can use the NOPASSWD attribute in the sudoers file to tell sudo not to require a password. A line like the follows in the sudoers file should let you run that command without a password:

yourlogin ALL=(ALL) NOPASSWD: command_here

To edit the sudoers file, run the command sudo visudo.

carlin.scott
  • 105
  • 3
0

You can edit the sudoers file with the command sudo visudo.

As seen here https://unix.stackexchange.com/questions/18830/how-to-run-a-specific-program-as-root-without-a-password-prompt?newreg=fb648518a0b0446e92cb2a685755daca

Your command that you want to authorize should be the path to it or you will get an error.

yourlogin ALL=(ALL) NOPASSWD: /path/to/my/command_here
Allenile
  • 101
0

You can edit the sudoers file by executing the following line:

sudo gedit /etc/sudoers

add the following line to the file: your_login ALL=(ALL) NOPASSWD: command

Nemcruncher95
  • 688
  • 6
  • 25