LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 05: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, 05: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, 07: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, 09: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, 09: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, 05: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, 07:10 AM   #7
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
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, 09: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, 09:33 PM   #9
tommytomthms5
Member
 
Registered: Sep 2007
Distribution: debian based
Posts: 308

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

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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, 09: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 10:44 PM.
 
Old 05-19-2008, 12:08 AM   #12
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
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, 12:39 AM   #13
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Gurgaon, India
Distribution: Cent OS 6/7
Posts: 4,631

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, 07: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, 07:44 PM   #15
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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



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

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

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