I really tried to find a solution before posting here, however I couldn't find any.

I tried to allow a specific user to run apt update and apt upgrade for a without entering his password, so I did a sudo visudo and edited the line for this user:

user ALL=(ALL) NOPASSWD: /usr/bin/apt update /usr/bin/apt upgrade

sudo -l gives me the following output:

User user may run the following commands on machine:
    (ALL : ALL) ALL
    (ALL) NOPASSWD: /usr/bin/apt update /usr/bin/apt upgrade

What am I missing? Just allow ALL is no option. The order should be fine. Any help much appreciated.

  • you might use username ALL = NOPASSWD : /usr/bin/apt-get , /usr/bin/aptitude the update/upgrade & so on parameters is on the command line sudo aptitude update for example ; not in the sudoers file.
    – francois P
    Jul 4 at 11:30
  • @ShahFahad quoting them does not work. throwing syntax errors.
    – moTHO.
    Jul 4 at 11:35
  • 2
    Did you try putting a comma between the commands in the sudoers file? I can't see how sudo would otherwise be able to determine that the list of words are two separate commands with arguments.
    – Kusalananda
    Jul 4 at 11:54
  • 2
    @MarcusMüller thats why I just wanted update & upgrade :)
    – moTHO.
    Jul 4 at 12:25
  • 1
    @MarcusMüller I think sudo would ask for a password if any other arguments are given
    – rowboat
    Jul 4 at 15:08

The separate commands needs to be separated by a comma in the sudoers file, e.g.

user ALL=(ALL) NOPASSWD: /usr/bin/apt update , /usr/bin/apt upgrade

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.