LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 02-16-2015, 11:11 AM   #1
james.brown
Member
 
Registered: Feb 2015
Posts: 40

Rep: Reputation: Disabled
For security, do i need disable sudo?


For security, do i need disable sudo?
 
Old 02-16-2015, 11:50 AM   #2
Keith Hedger
Senior Member
 
Registered: Jun 2010
Location: Wiltshire, UK
Distribution: Void, Linux From Scratch, Slackware64
Posts: 3,150

Rep: Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856Reputation: 856
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.
 
Old 02-16-2015, 11:50 AM   #3
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
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.
 
1 members found this post helpful.
Old 02-16-2015, 11:55 AM   #4
james.brown
Member
 
Registered: Feb 2015
Posts: 40

Original Poster
Rep: Reputation: Disabled
if browser loaded virus, then virus can up-privilegies with sudo?
 
Old 02-16-2015, 12:07 PM   #5
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by james.brown View Post
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.
 
Old 02-16-2015, 02:34 PM   #6
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
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.
 
Old 02-16-2015, 02:41 PM   #7
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
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.
 
Old 02-16-2015, 05:36 PM   #8
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,659
Blog Entries: 4

Rep: Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941Reputation: 3941
Quote:
Originally Posted by rknichols View Post
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.
 
Old 02-16-2015, 05:41 PM   #9
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,627

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
Ditto, I think.

I agree with sundialsvcs, but would add that controlling exactly that process is what sudo is best used for.
 
Old 02-16-2015, 06:28 PM   #10
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,779

Rep: Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212Reputation: 2212
Quote:
Originally Posted by sundialsvcs View Post
... 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.

Last edited by rknichols; 02-16-2015 at 06:33 PM.
 
Old 02-16-2015, 06:52 PM   #11
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
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/

Last edited by metaschima; 02-16-2015 at 06:54 PM.
 
1 members found this post helpful.
Old 02-17-2015, 06:46 AM   #12
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Quote:
Originally Posted by metaschima View Post
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.
 
Old 02-17-2015, 08:04 AM   #13
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by sundialsvcs View Post
... 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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How To Disable PAM Authentication for SUDO YankeePride13 Linux - Server 7 03-14-2013 12:35 AM
Disable root login, but still be able to sudo -s after logged with another user (ssh) ytd Linux - General 12 04-25-2010 11:34 AM
disable sudo su - prayag_pjs Linux - Newbie 4 09-17-2009 12:30 AM
Slackware Security Update: sudo trickykid Slackware 3 05-01-2002 10:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 02:42 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration