LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   switch to root user (https://www.linuxquestions.org/questions/linux-newbie-8/switch-to-root-user-637732/)

bdavide 04-25-2008 05:44 AM

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...

jakev383 04-25-2008 05:49 AM

Quote:

Originally Posted by bdavide (Post 3132420)
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"

Barun 04-25-2008 07:16 AM

hii
try su -

or go to > switch user > and then graphically go root and enter passwd

ischi 04-25-2008 09:45 AM

you can also use sudo -s once to become root and then set the root password using passwd

bdavide 04-25-2008 09:48 AM

Thanks to everyone for the info

smus 04-28-2008 05:18 AM

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.

pixellany 04-28-2008 07:10 AM

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

yaye 05-18-2008 09:23 PM

Quote:

Originally Posted by pixellany (Post 3135438)
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.

tommytomthms5 05-18-2008 09:33 PM

I like Debian ("in the raw" as I say) it's a little better

jschiwal 05-18-2008 09:40 PM

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.

yaye 05-18-2008 09:55 PM

Quote:

Originally Posted by jschiwal (Post 3157483)
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?

chrism01 05-19-2008 12:08 AM

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.

linuxlover.chaitanya 05-19-2008 12:39 AM

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.

yaye 05-19-2008 07:29 PM

Quote:

Originally Posted by chrism01 (Post 3157562)
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.

jschiwal 05-20-2008 07:44 PM

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.


All times are GMT -5. The time now is 11:40 PM.