Wednesday, May 15, 2024
 Popular · Latest · Hot · Upcoming
6
rated 0 times [  6] [ 0]  / answers: 1 / hits: 8972  / 2 Years ago, tue, june 14, 2022, 6:16:06

I've grown tired of always invoking apt-get update and apt-get upgrade under sudo and typing my password, so I have added the following line to my /etc/sudoers file using visudo:



<myusername> ALL=NOPASSWD: /usr/bin/apt-get


Unfortunately when I invoke apt-get I am met with the following error:



<myusername>@sputnik:~$ apt-get update
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?


I have tried to add the following (fairly obvious) line to /etc/sudoers too but to no effect



<myusername> ALL=NOPASSWD: /usr/bin/dpkg


What must I do?


More From » apt

 Answers
0

Even with that configuration in /etc/sudoers, you will still need to use sudo to run apt-get as root. The difference is that with proper configuration you will no longer need to type in your password.


[#25292] Thursday, June 16, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sweetrifiabl

Total Points: 422
Total Questions: 94
Total Answers: 120

Location: Bonaire
Member since Sat, Sep 24, 2022
2 Years ago
;