LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   For security, do i need disable sudo? (https://www.linuxquestions.org/questions/linux-security-4/for-security-do-i-need-disable-sudo-4175534201/)

james.brown 02-16-2015 11:11 AM

For security, do i need disable sudo?
 
For security, do i need disable sudo?

Keith Hedger 02-16-2015 11:50 AM

If you don't have sudo you can't do anything that needs admin privileges as a normal user, also a number of packages use sudo as a backend, of course if you don't add a user to the sudoers file in /etc that user can't use sudo anyway so sudo is pretty secure, unless you know what you are doing I would leave sudo alone.

rtmistler 02-16-2015 11:50 AM

I think you need to "administer" sudo and properly configure it so that it can safely be used. The regular users will need root privileges from time to time and sudo is the best manner to give it to them.

james.brown 02-16-2015 11:55 AM

if browser loaded virus, then virus can up-privilegies with sudo?

rtmistler 02-16-2015 12:07 PM

Quote:

Originally Posted by james.brown (Post 5318182)
if browser loaded virus, then virus can up-privilegies with sudo?

Technically yes.

It can't find the root password and send that to someone remotely.

It has to be run somehow, for instance it has to be a Linux script or binary executable, and not something for another system.

273 02-16-2015 02:34 PM

Personally I'm not convinced of the value of sudo on a single-user system, and haven't found a use for it myself, but on a server it is usually used to increase security as it can be used to give minimal permissions where needed.

rknichols 02-16-2015 02:41 PM

I have a few cron jobs that run under my regular ID but need root privilege to do one or two specific things (e.g., reading the counts from some iptables rules). I can set up sudoers to allow my ID to run just those exact commands with no password. Any other way would be granting more privilege than is needed.

sundialsvcs 02-16-2015 05:36 PM

Quote:

Originally Posted by rknichols (Post 5318283)
I have a few cron jobs that run under my regular ID but need root privilege to do one or two specific things ...

... whereas my personal "take" on this point would be, "where is the 'bright line rule™' here?"

The computer cannot distinguish between "a sudo request issued by <<user-X>> in a cron job," from ... "any other sudo request issued by <<user-X>>."

From the computer's point of view, "either: <<user-X>> is allowed to 'use sudo', or: 's/he is not.'"

If you need to do "certain things" that are "an exception to the rule" for your <<user-X>>, then you should arrange to have them be performed under the auspices of a different user-ID, which has elevated privileges and which is expressly used for no other purpose. Only then, does "the binary machine" have "a binary bright-line rule" that it can actually use and enforce.

wpeckham 02-16-2015 05:41 PM

Ditto, I think.
 
I agree with sundialsvcs, but would add that controlling exactly that process is what sudo is best used for.

rknichols 02-16-2015 06:28 PM

Quote:

Originally Posted by sundialsvcs (Post 5318368)
... whereas my personal "take" on this point would be, "where is the 'bright line rule™' here?"

The computer cannot distinguish between "a sudo request issued by <<user-X>> in a cron job," from ... "any other sudo request issued by <<user-X>>."

It doesn't need to. The commands are harmless, collecting certain statistics from the networking. The sudoers lines permit those particular commands to be run only with those exact arguments. Anyone who gets into my ID and is really interested in how many bytes were sent and received on interface eth1 can run them. That would be about the least harmful thing they could do.

Creating another ID with elevated privileges would represent a much more serious security hole unless done very, very carefully. sudo takes that care for me.

metaschima 02-16-2015 06:52 PM

First, there are different ways to configure sudo. Some ways are secure, some are not.

If you configure sudo yourself for a user, and understand what you are doing, then it can be secure.

If you just use sudo as you would su (with full privileges), then I believe it is less secure than su. The main difference being one password versus two different passwords. Although you do have to put in a password every time you run a command with sudo or su, the fact that su requires a different password makes it more secure.

A user password is typically used more often than the root password, or that's the way it should be. I mean, I login to my computer every day with my user password, but I don't necessarily use my root password every day. The Ubuntu argument is that sudo is better because it prevents users from running as root. This is not entirely correct. Using sudo is definitely better than running as root, but using a different password for root is better still.

For newbies/Ubuntu users it works pretty well, but isn't optimal IMO.

You do not need to disable sudo, but you should know what it is and how to configure it.

Here is an article on it:
http://mylinuxbook.com/sudo-vs-su-in-ubuntu-linux/

rtmistler 02-17-2015 06:46 AM

Quote:

Originally Posted by metaschima (Post 5318414)
First, there are different ways to configure sudo. Some ways are secure, some are not.

If you configure sudo yourself for a user, and understand what you are doing, then it can be secure.

If you just use sudo as you would su (with full privileges), then I believe it is less secure than su. The main difference being one password versus two different passwords. Although you do have to put in a password every time you run a command with sudo or su, the fact that su requires a different password makes it more secure.

A user password is typically used more often than the root password, or that's the way it should be. I mean, I login to my computer every day with my user password, but I don't necessarily use my root password every day. The Ubuntu argument is that sudo is better because it prevents users from running as root. This is not entirely correct. Using sudo is definitely better than running as root, but using a different password for root is better still.

For newbies/Ubuntu users it works pretty well, but isn't optimal IMO.

You do not need to disable sudo, but you should know what it is and how to configure it.

Here is an article on it:
http://mylinuxbook.com/sudo-vs-su-in-ubuntu-linux/

I agree here and it better echoes my original sentiment that you should keep sudo and learn how to properly configure it so that any security concerns are alleviated.

Thanks for finding a good reference.

jpollard 02-17-2015 08:04 AM

Quote:

Originally Posted by sundialsvcs (Post 5318368)
... whereas my personal "take" on this point would be, "where is the 'bright line rule™' here?"

The computer cannot distinguish between "a sudo request issued by <<user-X>> in a cron job," from ... "any other sudo request issued by <<user-X>>."

From the computer's point of view, "either: <<user-X>> is allowed to 'use sudo', or: 's/he is not.'"

Um... sudo can prevent the usage to the command specified in the configuration file for that specific user.

Now doing something stupid like adding an editor (or allowing access to a shell) in there is a different thing.
Quote:


If you need to do "certain things" that are "an exception to the rule" for your <<user-X>>, then you should arrange to have them be performed under the auspices of a different user-ID, which has elevated privileges and which is expressly used for no other purpose. Only then, does "the binary machine" have "a binary bright-line rule" that it can actually use and enforce.
No issues there.


All times are GMT -5. The time now is 08:59 AM.