LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-11-2005, 12:30 AM   #1
yubimusubi
LQ Newbie
 
Registered: Apr 2005
Location: Seminole, FL
Distribution: Gentoo 2005.1 (Stage 1)
Posts: 19

Rep: Reputation: 0
Exclamation sudo password...?


Okay, call me naive...

I've installed (and used) sudo on a number of distros (debian, ubuntu, gentoo) and I can not understand the security in it. Perhaps I have it set up wrong? (and always have?)

Okay, so is it supposed to be that when sudo asks you for a password you type in the user's password? Wouldn't that mean that anyone who knows the password of the user can run applications/commands as root?

I'm sorry, it would just make more sense to me if it actually asked you for the *root* password instead. Just my two cents.
 
Old 09-11-2005, 12:36 AM   #2
aysiu
Senior Member
 
Registered: May 2005
Distribution: Ubuntu with IceWM
Posts: 1,775

Rep: Reputation: 86
Read this:

https://wiki.ubuntu.com/RootSudo
 
Old 09-11-2005, 01:30 AM   #3
yubimusubi
LQ Newbie
 
Registered: Apr 2005
Location: Seminole, FL
Distribution: Gentoo 2005.1 (Stage 1)
Posts: 19

Original Poster
Rep: Reputation: 0
Okay, that was a nice read, and some good information about sudo, but I don't see how the article addresses the security issues at stake. If a hacker can get into your system's sudo-priveleged user's account (considering I run linux as a desktop, that's not extremely important to me...despite a few days of troubleshooting), I believe it would be a lot easier for him to do serious damage.

For the hacker to compromise your system, he must simply learn the user password (with most of the people I know, that's the same password they use for everything; phishing would work against the n00b no problem), then sudo whatever commands he wants with the user password, such as "rm -Rf /" or something. Heheheh...

I guess that's a pretty far-fetched scenario, but it /does/ feel a bit less secure to me.

According to the article, however, it would seem that the security (in theory) is the same as su, but I believe in practice it is somewhat less secure.
 
Old 09-11-2005, 01:48 AM   #4
JCipriani
Member
 
Registered: Aug 2005
Location: Pittsburgh, PA, USA
Distribution: Redhat 9, OS X 10.4.x, Win2K
Posts: 85

Rep: Reputation: 15
Quote:
Originally posted by yubimusubi
... If a hacker can get into your system's sudo-priveleged user's account ...

...with most of the people I know, that's the same password they use for everything; phishing would work against the n00b no problem...
But therein lies your security problems.

1) Using the same password for everything is a serious security risk.
2) If you are a user with sudo privileges then it is your responsibility to make sure that your password is -not- easy to guess. An individual user's password should be just as "sacred" as root's password.
3) "N00bs" should not be given sudo privileges.

A responsible sys admin would only give sudo privileges to responsible users, and a user that can't pick a good password is not a responsible user. Also, you can limit the commands available via sudo to various users, but that doesn't change the fact that picking bad passwords is not a good thing to do.

Depending on what you are trying to do, you may also want to consider not using sudo and doing things another way. For example, if you are letting users have sudo privileges so that they can say, run a program that writes to a file in a place only root has access to; consider setuid'ing that program to root (and making sure only root has write access to the binary itself) instead if you trust the program more than the users and you know the program can't do anything evil.

Also, that link does mention security issues and compares it with su and not using sudo at all.

Jason

Last edited by JCipriani; 09-11-2005 at 02:05 AM.
 
Old 09-11-2005, 02:15 AM   #5
aysiu
Senior Member
 
Registered: May 2005
Distribution: Ubuntu with IceWM
Posts: 1,775

Rep: Reputation: 86
Quote:
Originally posted by yubimusubi
For the hacker to compromise your system, he must simply learn the user password (with most of the people I know, that's the same password they use for everything; phishing would work against the n00b no problem), then sudo whatever commands he wants with the user password, such as "rm -Rf /" or something. Heheheh...
But how is that any different from the theoretical hacker "simply" learning the root password. If someone keeps a lousy username password, she's also likely to keep a lousy (i.e., easy-to-guess) root password.

Also, if you have to log in as root or su, it's possible to just leave yourself logged in there for a while. You have to sudo every command you put in.
 
Old 03-03-2009, 07:49 AM   #6
dvs01
LQ Newbie
 
Registered: Mar 2009
Posts: 2

Rep: Reputation: 0
Quote:
Originally Posted by aysiu View Post
Also, if you have to log in as root or su, it's possible to just leave yourself logged in there for a while. You have to sudo every command you put in.
Not true. You can leave yourself logged in via sudo the same way as with su. Done like this:
# sudo su -

A benefit of sudo that has been missed in this thread is the fact that it can be configured for its own passwords. See this URL for more details:
http://www.ducea.com/2006/06/18/linu...sswd-nopasswd/

Set up properly, the user would have to do this in order to gain root access:

- Log on to the machine with the appropriate username and the user's password
- Run commands as root via sudo, using his/her specific sudo password.

This adds an extra layer of security. Compromising the user's account password doesn't compromise root access, unless both passwords are compromised.
 
Old 03-03-2009, 04:09 PM   #7
synss
Member
 
Registered: Jul 2007
Location: Germany
Distribution: Debian, Gentoo, Mac OS X
Posts: 137

Rep: Reputation: 22
Quote:
Originally Posted by dvs01 View Post
Not true. You can leave yourself logged in via sudo the same way as with su. Done like this:
# sudo su -
Well, actually no, done like this: sudo -s see man 8 sudo.

And you can configure sudo to use the root password if you like. But I believe that locking root is more secure, since the hacker theoretically has to guess your username + password, when root's username is just... "root".
 
Old 03-03-2009, 04:24 PM   #8
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
Yeah, that is it, most hackers instinctively present themselves as "root". The absence of root is an extra hurdle for them to take.
 
Old 03-25-2009, 08:14 PM   #9
Kaname
LQ Newbie
 
Registered: May 2006
Posts: 15

Rep: Reputation: 0
The problem I see with "sudo" is that when you install Ubuntu (for example) it ask you for the default user/password which has "sudo" privileges.

If the person is installing Ubuntu for the first time and has almost no experience with Linux (and maybe believes that it would be the same as in Win.) then it would choose an easy username and easy password (to prevent forgetting it).

So, because it has "sudo" privileges, technically any person could guess the username/password if can get some information about that person (emails usernames, forum usernames, etc...). Maybe not that easy...

Even this post was created in 2005, still worthy to talk about it...

Cheers!
 
Old 03-25-2009, 11:50 PM   #10
JulianTosh
Member
 
Registered: Sep 2007
Location: Las Vegas, NV
Distribution: Fedora / CentOS
Posts: 674
Blog Entries: 3

Rep: Reputation: 90
You guys are missing the point of sudo.

Sudo is meant to allow non-root users to run very specific commands as root. The key words to think about are "very specific commands".

It is extrememly bad form to allow a user to run any command, or even open-ended commands as root. Some BAD examples would be allowing a user to 'sudo bash', 'sudo rm', etc.

The proper usage to allow a user to delete files would be to put specific rm commands in a batch file that delete a specific directory, and then give the user rights to run the script as sudo. The point being that you restrict any additional or unforseen opportunity for the user to modify, expand, or change what they are allowed to do as root.

The purpose of asking the user to type in a password is an additional security measure for the id10T user that is granted sudo access and still doesn't secure their terminal during the day - that would allow anyone to come up and 'sudo -l' and run all the sudo commands available to them without authentication.
 
Old 03-26-2009, 07:32 AM   #11
AlucardZero
Senior Member
 
Registered: May 2006
Location: USA
Distribution: Debian
Posts: 4,824

Rep: Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615Reputation: 615
Quote:
Originally Posted by synss View Post
Well, actually no, done like this: sudo -s see man 8 sudo.
Code:
      -s  The -s (shell) option runs the shell specified by the SHELL environment variable if it
           is set or the shell as specified in passwd(5).
Okay.. I don't get it, can you explain the difference between sudo -s, sudo bash, and sudo su, assuming bash is the default shell? I don't think any of them initialize the environment like a root login (add the - after su to get that), so why did you say "actually, no, rtfm"?
 
Old 03-27-2009, 02:26 AM   #12
synss
Member
 
Registered: Jul 2007
Location: Germany
Distribution: Debian, Gentoo, Mac OS X
Posts: 137

Rep: Reputation: 22
sudo su or sudo su - are redundant. sudo bash or sudo bash -l will start bash, but I, for example, am a zsh user and some other people prefer tcsh, etc.

So if you want a shell to perform administration,you should start it with sudo -s or sudo -i if you insist on having a login shell. For more options, you can also play with the env_keep options in the sudoers file.

Now, I am not sure why you would actually want a login shell. Maybe you can enlighten me.
 
Old 09-03-2009, 10:03 PM   #13
andretapada
LQ Newbie
 
Registered: Sep 2009
Posts: 1

Rep: Reputation: 0
For not create a unnecessary topic i don't understand this so much. I need tu use the terminal but it asks for a sudo password. It don't let me write nothing :s Anyone knows what it is?

Thanks
 
Old 09-03-2009, 10:05 PM   #14
JulianTosh
Member
 
Registered: Sep 2007
Location: Las Vegas, NV
Distribution: Fedora / CentOS
Posts: 674
Blog Entries: 3

Rep: Reputation: 90
it is asking for your password (not root) and it will not echo it back to you. just type it in.
 
Old 09-04-2009, 12:05 AM   #15
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
To reinforce the Admiral's post #10, the original idea of sudo was for root to allow a 'normal' user eg an operator to run a specific privileged cmd eg tape backup on a specific box (or boxes).
This is how the sudoers file is designed, if you read the extensive doc at the top of the file.
The fact that so many people set it as

sudo su -

is the admins fault, not the SW's, it was never meant for that abuse. Ubuntu doesn't help by locking the true root acct, thereby requiring a 'sudo su -' enabled acct to actually admin the box.
Its totally against the *nix way and only they do it.(afaik).
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sudo Su denies password accepted bu just Su arew264 Linux - Software 2 09-29-2005 07:35 PM
make sudo ask for a password andy753421 Linux - Security 1 01-13-2005 07:32 PM
root password doesn't work when I use sudo ... bucovaina78 Linux - Security 5 11-10-2004 02:50 PM
Sudo authorizes me with incorrect password? jhermans Linux - Security 4 08-29-2004 09:15 PM
Piping password to sudo Umek Linux - General 7 03-21-2004 01:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:29 PM.

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