Enable and change the password/login for the Root user in Ubuntu

Source: Internet
Author: User

Run the following command as the root user:

Sudo passwd root

You will be prompted to enter the root user password, enter the root password continuously, and then use: $ su

1. After executing the sudo passwd root command on the terminal, the system will prompt you to set a new root account password.

2. Click System-> Preferences-> Login Window menu, switch to the Security option page, and select the "Allow local system administrator login" option. After performing the preceding two steps, you can use the root account to log on to the Ubuntu system.

Follow the output prompt to enter a new password and confirm it. (if you have set a password before, enter the previous password. Otherwise, you cannot change the password ). After you restart Ubuntu or log out of the current user, you can log on with the root user (the root name is case sensitive !!!).

If you only want to switch to the root account in terminal mode (for temporary use), you can use:

The temporary switch command is as follows:

Sudo-s-H

Enter the root password as prompted.

Note: Other platforms may use su root and su-root (if the current logon account is root and you want to switch to another xxx user, you only need to execute su xxx without entering the password ). The password is saved for 15 minutes by default. If it exceeds the time limit, you may need to enter the password again.


II. Close the root account

The command to disable the root account logon is as follows:

Sudo passwd-l root

3. Resetting the root password

The command is the same as the command for enabling the root password:

Sudo passwd root

Use the root account to log on to Ubuntu

In fact, I personally think this is not necessary, because when you need the root permission, you can use sudo. If you need to enable the root account in Ubuntu, perform the following operations:
1. Reset the root password: $ sudo passwd root
# Enter the new password twice as prompted and confirm the password.
2. Enable root user logon: $ sudo vi/etc/TPD. conf
# Open the gnome configuration file, input: AllowRoot press enter in the last line mode, find AllowRoot = false, change false to true, save the file, and exit.
After that, you can log on to the system as the root user. If you want to disable the root account, run the following command: $ sudo passwd-l root
The root account in Ubuntu is disabled by default. In this case, if you want to use the root permission to do something, you need the sudo command. For some friends, they may need to activate the root account in Ubuntu.

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.