-3

i run like this:

prod:~$ sudo visudo

and then i added myusername here

# User privilege specification
root    ALL=(ALL:ALL) ALL
foobar ALL=(ALL:ALL) NOPASSWD:ALL

i tried this also:

sudo sh -c 'echo "foobar ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/90-foobar'

then i tried to run apt-get update got this:

Reading package lists... Done
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)

i want to run any commands without sudo , not only apt-get update/upgrade but all , i have look some questions and answers on google, and do it but still doesn't work

how to solve this ??

  • whats the point ? can't u explain why u triggeer me to there? @Terrance – Pi L May 22 at 22:36
  • 1
    "no password" does not mean "no sudo" - you still need to prefix the command with sudo, you just don't get asked for a password after – steeldriver May 22 at 22:39
  • It was too explain why you have to type in sudo. You cannot run the commands without sudo unless you switch to root. – Terrance May 22 at 22:59
  • 1
    @steeldriver Would you like to post an answer? – Kulfy yesterday
0

It is not possible to run all commands, for which you do not have privileges, without sudo.
Solutions how to execute commands without sudo are:

  1. Became root: sudo su -
  2. Use acl for specific files or folders
    sudo setfacl -Rm u:your_username:rwx /var/lib/apt/lists/
    sudo setfacl -Rm u:your_username:rwx /var/cache/apt/

It is not safe to be an administrator all the time at your machine.

| improve this answer | |

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.