Switching between root and User Users in Ubuntu

Source: Internet
Author: User

Ubuntu is a popular Linux system recently. Because ubuntu does not start the root user by default, we will introduce how to enter the root user.


(1) switch from user to root user

Whether logging on to Ubuntu in graphical mode or logging on in command line mode, we will find that the default user is user

However, when we need to perform operations with root permissions (such as repairing and returning system files), we often need to use sudo authorization, which is very troublesome.

Now we can switch to the root user, just execute sudo Su.

Note: For security reasons, by default, the root user of ubuntu does not have a fixed password. The password is randomly generated and dynamically changed.

Is changed every five minutes, so su (switch user) is not allowed, because we do not know the root password.

 

(2) switch from root user to user

To switch the user from the root user back to the user, you only need to execute the command: su user (user is the user name when you install the user), or directly enter exit, you can also press Ctrl + D to launch

 

(3) set a password for the root user.

By default, the root user has no fixed password and is locked. If you want to set a password for the root user

You only need to execute the command: sudo passwd root and then follow the prompts one step at a time.

In this way, you can enter the root password to switch to the root user as mentioned in (1 ).

Note: After setting the password for the root user, you can still switch sudo Su to the root user.

Appendix: in graphic mode, choose system> System Management> users and groups. You can also set a password for the root user.

 

(4) Disable and enable root logon

Run the sudo passwd-l root command (only root is disabled, but the root password is still saved), and then run the su root command to find that the authentication fails,

Start the root login again and run sudo passwd-u root.

 

(5) Enable Ubuntu to log on automatically

In graphic mode, choose system> System Management> logon window, authorize and unlock, and select

Automatically log on as a user.

 

Note: My Ubuntu is of the 10.04 server version.


[Transfer] http://www.cnblogs.com/weiweiqiao99/archive/2010/11/10/1873761.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.