How to stop sudo access for apt-get install command?

762 Views Asked by At

I am using ubuntu server on which some commands like

apt-get install

needs sudo access so need to stop sudo access for that specific command i.e. while executing that command we don't need sudo access. So how to any solution for this ?

1

There are 1 best solutions below

1
On

There are any number of ways to do this.

One which springs immediately to mind is to have a setuid script which does the job for you. Make it owned by root and also runnable by the group aptgrp (which you create and manage yourself).

The script will basically take arguments then call apt-get in turn, but as the root user.

However, I'd advise against this since you're creating a new tool with all the opportunities for getting security wrong. Especially since sudo can be configured in great detail in what programs you're allowed to run (no need to open up everything with "pax ALL=(ALL) ALL") and whether or not you need to supply a password for it (the "NOPASSWD" clause).

I'd look into configuring sudo correctly before attempting any other solution.