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) switching from a user to a root user, whether logging on to Ubuntu in graphic mode or logging on in command line mode, we will find that the default user is user, but when we need to perform some operations with root permissions (such as repairing and returning system files), we often need to use sudo authorization, we can switch to the root 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.

In this case, we can switch to the root user and simply executeSudo suYou can.

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.Su (switch user)No, because we don't know the root password.

(2) switch from root user to user

To switch from the root user to the user, you only need to execute the following command:Su user(User is the user name for your own installation), or directly enterExit, or press Ctrl + D.

 

(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

Run the following command:Sudo passwd rootThen follow the prompts to proceed step by step

As mentioned in (1 ),Su root, Enter the root password to switch to the root user

Note: After setting the password for the root user, you can stillSudo suSwitch to the root user

Appendix: in graphic modeSystem> System Management> users and groupsYou can also set a password for the root user.

(4) Disable and enable root logon

RunSudo passwd-l rootYou can (only disable root, but the root password is still saved), and then execute su root to find that authentication fails,

Start root login again and runSudo passwd-u rootYou can.

(5) Enable Ubuntu to log on automatically

In graphic modeSystem> System Management> logon windowSelect

Automatically log on as a user.

Note: My Ubuntu is of the 10.04 server version.

Related Article

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.