LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-07-2010, 07:39 AM   #1
linux.ab
Member
 
Registered: Jan 2010
Posts: 63

Rep: Reputation: 15
Question some queries about sudo in ubuntu 9.10


hi as a new user i want to know the following things...

sudo su - ....i am able to use as root without giving root password..so what is use of it?

difference between sudo - ,sudo su - and sudo su....all are asking about root password..
 
Old 04-07-2010, 07:49 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
Ubuntu has adopted and non-standard way of handling system admin privileges. Using sudo, they give the first user the administration powers normally associated with the "root" user. The "sudo" command can be defined as "do this with admin privileges".

In a "normal" system, "su" means "switch user". With no arguments, it means "switch to the root user". In Ubuntu, the root user is disabled, so I'm not sure what "sudo su" does.

To help understand how all this works, you can enable the root account by entering "sudo passwd root". You'll be asked for your regular user password, and then you'll be prompted to enter a root password.
 
1 members found this post helpful.
Old 04-10-2010, 05:29 AM   #3
linux.ab
Member
 
Registered: Jan 2010
Posts: 63

Original Poster
Rep: Reputation: 15
so that means that a normal user who is not administrator can have administration/root privileges..that means he/she can install any software at will...
 
Old 04-10-2010, 06:01 AM   #4
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
No. You are misunderstanding it. When you install Ubuntu, the first user created at installation gets all the sudo privileges. Other users need to be given sudo privileges explicitly.
So if the user does not have sudo permissions, he/she will not be able to do the administrative tasks.
Also sudo does not need root password. It authenticates using the password of the currently logged in user.
su will need root password which is not set in Ubuntu by default and is not advised as well.
 
1 members found this post helpful.
Old 04-10-2010, 06:03 AM   #5
johntait1
LQ Newbie
 
Registered: Jul 2007
Posts: 8

Rep: Reputation: 0
Not quite right what happens is this you want to issue a command which requires root privileges for example edit Xorg.conf file or use synaptics for example you are asked for your password and if you give it correctly you can now you can go ahead and do your admin task but lets say you now type sudo su which means switch user in this case to root your prompt will show # and you are now the traditional root user.
However if you close the terminal window and open another one 5mins later you will have to enter your password to gain root privileges it means when you have a few root admin tasks you don't have to keep giving your password time and time again.
 
1 members found this post helpful.
Old 04-10-2010, 07:09 AM   #6
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
And what was not quite right with my post?
 
Old 04-10-2010, 07:39 AM   #7
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Ubuntu has not "disabled" the root user in the sense that the user account can be used, but there is no usable password set, so one cannot log in as root the way one can log in as a regular user. This means that
Code:
su
could not be used, because it requires root password, which cannot be used. However, if one is already working with root privileges, then "su" does not ask for the password, and thus using "sudo" to run "su" will ask for the password of the user, and if it is correct (and the user is allowed to run that command with sudo), then "su" is run with root privileges, effectively switching the user to root (the dash in the end of the command affecting the environment of the newly switched user).

If there is only one user on the system, using "sudo" is mostly the same as if one just had a regular root user account, with the exception that
1) there is no need to explicitly switch to the root account to do things with root privileges and
2) the password given to "sudo" may be remembered for a short while, so several commands (within a certain time interval) may be run using "sudo" without having to type the password again each time

With multiple users on the system rights to "sudo" can either be given for one user only, making that user very much resemble a root user, or then the rights can be given to multiple users. With multiple users being able to use "sudo" the system may have several "admin users", and actions made may be supervised a little better, because they're done under a different user id, instead of several people all using the root account which means it may be impossible to say who did what (because they all do it as root). There's also a possiblity to restrict actions; real root user is not limited in any way, but users who use "sudo" can be controlled via /etc/sudoers by explicitly defining what they can run with "sudo". For example an admin user can be allowed to run certain commands, but only those, so s/he may not run "su", "sudo", shell or other things that would grant her/him access to the true root user account.

Using "sudo" is one kind of a two-edged sword: on the other hand it may ease writing directions for inexperienced users that require root privileges, it may ease system administration by allowing more than one separate administrative user account and it allows for restricting the elevated privileges to certain commands only etc., but on the other hand it opens one new possibility to exploit the higher privileges (causing more brainwork when thinking of giving "sudo" permissions), deviates the way from the old standards as mentioned by pixellany and possibly makes the whole privileges system more difficult to understand.
 
1 members found this post helpful.
Old 04-10-2010, 09:35 AM   #8
snowpine
Senior Member
 
Registered: Feb 2009
Posts: 4,244

Rep: Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199Reputation: 1199
All of this is well documented.

https://wiki.ubuntu.com/RootSudo

You'll notice for example that 'sudo su' is not recommended. If you read the document, you'll see that basically, you can do anything with sudo without ever needing to log in as root.

You are of course free to give root a password (as described in post #2). However, I recommend that, as a new Ubuntu user, you stick with the default (root account has no password; use sudo instead) while you are learning. I suggest this, not because I think sudo is superior to su (or vice versa) but because all of the Ubuntu documentation, tutorials, tips, help forums, etc. assume you'll be using sudo instead of su. So, using the default will make it easier for you to get help and find answers to your questions.

If however you never use the Ubuntu documentation, and prefer to follow instructions that are written for another distro (for example there is a lot of crossover between Debian and Ubuntu users), maybe you'll find it preferable to give root a password. It is up to you, but now you know my opinion.

Last edited by snowpine; 04-10-2010 at 09:37 AM.
 
1 members found this post helpful.
Old 04-12-2010, 04:08 AM   #9
johntait1
LQ Newbie
 
Registered: Jul 2007
Posts: 8

Rep: Reputation: 0
For linuxlover.chaitanya I was not refering to your post it wasn't there when I started typing
 
Old 04-12-2010, 05:11 AM   #10
LouRobytes
Member
 
Registered: Mar 2010
Location: Nova Scotia, Canada
Distribution: Ubuntu & Fedora
Posts: 189

Rep: Reputation: 44
Thanks to all respondents. Knew how to use sudo su - to set a root password but didn't understand the rationale nor the mechanics of it all.

Cheers, Lou

EDIT: Think this approach is better than Fedora's since there is no root password and it forces the Linux newbie to be aware that he is executing a root-priviledge command every time he uses one.

Last edited by LouRobytes; 04-12-2010 at 05:49 AM.
 
Old 04-12-2010, 05:47 AM   #11
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
Quote:
Originally Posted by johntait1 View Post
For linuxlover.chaitanya I was not refering to your post it wasn't there when I started typing
No offenses taken or meant. Your post was below mine so I thought you had found something in my post I have mistaken or mistyped.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
LXer: The Ultimate Sudo FAQ To Sudo Or Not To Sudo? LXer Syndicated Linux News 13 04-13-2013 02:36 AM
Installing latest Sun JDK on Ubuntu - Queries wemurs Linux - Software 1 12-17-2009 06:49 AM
aftr sudo cmd and pswd i get this E: Type 'http://archive.ubuntu.com/ubuntu' is not k turoblaztr Linux - General 1 01-14-2007 11:29 AM
Frustrated with Ubuntu Sudo nev Linux - Newbie 8 07-05-2006 02:15 AM
Ubuntu and sudo oldstinkyfish Linux - Security 1 03-03-2005 02:44 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01: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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration