LinuxQuestions.org
Register a domain and help support LQ
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-25-2008, 06:44 AM   #1
bdavide
Member
 
Registered: Apr 2008
Location: ITALY
Distribution: Ubuntu 7.10
Posts: 62

Rep: Reputation: 15
switch to root user


Im getting confused with my user account and the root account.
When I installed Ubuntu, the installation asked me to provide a username and a password which I now used to login the system.

Now , when I want to switch to root , "su" prompts me for a password that I dont know.

Instead I use "sudo su" and type in my username`s password.

Is this the correct procedure to switch to root user? Please help me...
 
Old 04-25-2008, 06:49 AM   #2
jakev383
QmailToaster Developer
 
Registered: Dec 2005
Location: Burlington, NC
Distribution: CentOS, Voyage, Debian, Fedora
Posts: 220

Rep: Reputation: 31
Quote:
Originally Posted by bdavide View Post
Im getting confused with my user account and the root account.
When I installed Ubuntu, the installation asked me to provide a username and a password which I now used to login the system.

Now , when I want to switch to root , "su" prompts me for a password that I dont know.

Instead I use "sudo su" and type in my username`s password.

Is this the correct procedure to switch to root user? Please help me...
That's correct. root in Ubuntu (if I remember correct) had a random password generated at install so su won't work, but your user is allowed to sudo commands. To switch to root you could also "sudo -s"
 
Old 04-25-2008, 08:16 AM   #3
Barun
LQ Newbie
 
Registered: Apr 2008
Posts: 7

Rep: Reputation: 0
hii
try su -

or go to > switch user > and then graphically go root and enter passwd
 
Old 04-25-2008, 10:45 AM   #4
ischi
Member
 
Registered: Apr 2008
Location: Tübingen
Distribution: Fedora 9 (Thinkpad T60), Debian 3.1 (Server)
Posts: 51

Rep: Reputation: 15
you can also use sudo -s once to become root and then set the root password using passwd
 
Old 04-25-2008, 10:48 AM   #5
bdavide
Member
 
Registered: Apr 2008
Location: ITALY
Distribution: Ubuntu 7.10
Posts: 62

Original Poster
Rep: Reputation: 15
Thanks to everyone for the info
 
Old 04-28-2008, 06:18 AM   #6
smus
Member
 
Registered: Nov 2005
Location: Turkey
Distribution: Suse
Posts: 104

Rep: Reputation: 16
hello if you need to create a root password you can do it like this;

:~$ sudo passwd
Password:
Enter new UNIX password:
Retype new UNIX password:


after this step you can able to login with root user.
 
Old 04-28-2008, 08:10 AM   #7
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
The one and only flaw in Ubuntu......

Even after enabling the root account, you will still be prompted for your user password when trying to do admin tasks. You can get used to it, but I solved it by not using the _buntus
 
Old 05-18-2008, 10:23 PM   #8
yaye
LQ Newbie
 
Registered: Jan 2006
Posts: 7

Rep: Reputation: 0
Quote:
Originally Posted by pixellany View Post
The one and only flaw in Ubuntu......

Even after enabling the root account, you will still be prompted for your user password when trying to do admin tasks. You can get used to it, but I solved it by not using the _buntus
After giving root a new password with sudo passwd root and enabling local root X login, I logged as root, changed the /etc/sudoers file permissions to read,write by root, added targetpw to the line that begins with Defaults in the /etc/sudoers file, then changed the sudoers file back to read-only. Now the root password has to be given for system administration, not my user password.

With each release, Ubuntu seems to make it harder to use root the way I did in Redhat/Fedora. If they keep it up, I may return to Fedora or start using Debian or Mint.
 
Old 05-18-2008, 10:33 PM   #9
tommytomthms5
Member
 
Registered: Sep 2007
Distribution: debian based
Posts: 305

Rep: Reputation: 30
I like Debian ("in the raw" as I say) it's a little better
 
Old 05-18-2008, 10:40 PM   #10
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
As you can tell from the previous messages, Ubuntu disables root logins by default, and you are expected to use "sudo" and enter your own password. If you have other users on the system, not using targetpw in sudoers, allows you to give some administrative rights for certain commands without giving up the root password. This does require some work plugging holes, such as entering :!/bin/bash in vim, however if you are the only user, then targetpw is fine.

Many users using Ubuntu come from Windows and have the mind set to want to run as root when they shouldn't be. You probably have seen a number of messages on this site where people get in trouble doing weird things in system directories and then getting into trouble. It should never be necessary to log into an X windows session as root and doing so shouldn't be allowed either. Preventing these things helps protect newbies from themselves.
 
Old 05-18-2008, 10:55 PM   #11
yaye
LQ Newbie
 
Registered: Jan 2006
Posts: 7

Rep: Reputation: 0
Quote:
Originally Posted by jschiwal View Post
As you can tell from the previous messages, Ubuntu disables root logins by default, and you are expected to use "sudo" and enter your own password. If you have other users on the system, not using targetpw in sudoers, allows you to give some administrative rights for certain commands without giving up the root password. This does require some work plugging holes, such as entering :!/bin/bash in vim, however if you are the only user, then targetpw is fine.

Many users using Ubuntu come from Windows and have the mind set to want to run as root when they shouldn't be. You probably have seen a number of messages on this site where people get in trouble doing weird things in system directories and then getting into trouble. It should never be necessary to log into an X windows session as root and doing so shouldn't be allowed either. Preventing these things helps protect newbies from themselves.
Then why do both Debian and Redhat/Fedora allow setup of a user generated root password and root login in X?

Last edited by yaye; 05-18-2008 at 11:44 PM.
 
Old 05-19-2008, 01:08 AM   #12
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
Because the RH,Debian etc way is the way Unix (eg Solaris HP, AIX etc) works, the Ubuntu approach is non-std, which is more-or-less what some posters have alluded to above.
I prefer the orig Unix way myself as well, but jschiwal's 2nd para explains why Ubuntu did that.
 
Old 05-19-2008, 01:39 AM   #13
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
I use Ubuntu all the time in my office desktop and feel that not allowing root login in X is one of the good options Ubuntu has provided. I have seen some of the newbies in the office delete the system file unknowingly from X and then paying the price for it.
And jschiwal has already explained why this option can save systems. And I fully agree with him and I still use Ubuntu and like the option. With some usage you get used to it and dont mind providing password to keep your system safe. Atleast I dont mind it.
 
Old 05-19-2008, 08:29 PM   #14
yaye
LQ Newbie
 
Registered: Jan 2006
Posts: 7

Rep: Reputation: 0
Quote:
Originally Posted by chrism01 View Post
Because the RH,Debian etc way is the way Unix (eg Solaris HP, AIX etc) works, the Ubuntu approach is non-std, which is more-or-less what some posters have alluded to above.
I prefer the orig Unix way myself as well, but jschiwal's 2nd para explains why Ubuntu did that.
I prefer the "orig Unix" way of separating the root and user password also. In Ubuntu, anyone knowing the password of the user who installed it can use sudo, give root a new password and lock the user out of their own computer.

I know what Ubuntu was trying to do. I disagree with what I highlighted, in bold, in jschiwal's post. That is his opinion, not a fact and thankfully, the Redhat and Debian communities also disagree.

The so called "Ubuntu way" in regard to root and sudo is starting to remind me more of the "Microsoft way", we'll force you to do it our way.
 
Old 05-20-2008, 08:44 PM   #15
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
The only time in the last 2 or 3 years I can remember actually logging in as root was when I logged into a virtual terminal (in run level 3) to run the nvidia install program.
I usually use sudo. If I am in /var/log and looking at a number of root read only logs I might use "su -" instead. Running a command that redirects the output
is easier to do as root than using sudo. This is because the file descriptor is created using the effective uid of the sudo command, which is of the normal user.

There is a related difference between distros in using sudo as well. Fedora core & Ubuntu configure sudo by default to use the user's own password if they are a
member of the wheel group. OpenSUSE configures sudo so that you need to enter the root password. If you have more than one user on your system and you don't want to
give others the root password, then the former method is better IMHO.

I think that most distros seem to be adapting PolicyKit which may reduce the need to use sudo. Especially for common items performed graphically, such as ejecting a CD or DVD or USB device.
 
  


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
How do I switch to root user binarybob0001 Programming 4 11-26-2007 04:26 AM
How do you switch to root user barrythai Ubuntu 19 04-13-2007 12:55 PM
How do I switch ROOT/ADMINISTRATOR to another user?? Balarabay1 Linux - Software 4 07-21-2006 04:54 AM
switch to user installed window manager without root jaddison Linux - Software 13 04-13-2006 08:23 PM
How switch root to another user? Xiangbuilder Linux - Newbie 1 09-15-2003 08:19 AM


All times are GMT -5. The time now is 10:52 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