Linux Root User

Source: Internet
Author: User
ArticleDirectory
    • Security
1: Set the root password
After Ubuntu is installed, the root user does not have the default password, because you have not set the password for the root user.
Sonce @ sonce-desktop :~ $ Sudo-I
[Sudo] password for sonce:
Root @ sonce-desktop :~ # Passwd
Enter new Unix Password:
Retype new Unix Password:
Passwd: Password updated successfully
Or
The Default Root Password of Ubuntu is blank. When the GRUB menu is started, enter the revoer mode. Then, use the passwd root command to set the password for the root user.
2: log on with a root account in Ubuntu
Enable Root User Logon:
$ Sudo VI/etc/X11/TPD. conf # Open the gnome configuration file,
In the last row mode, enter "allowroot" and press enter, find "allowroot = false", change "false" to "true", and save the operation 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
To enable the root account, you can
After executing the sudo passwd root command on the terminal, the system will prompt you to set a new root account password.
Click System
-> Preferences-> login window menu, switch to the security option page, and select "allow"
Local System Administrator Login option.
If you always want to use root, you can also "Sudo-s ". Otherwise, use $ Su.

3: forgot password

I. Lilo Guidance
1. When lilo appears: Enter linux single
Boot: linux single
2. Press enter to directly enter linux single user mode
3. VI/etc/passwd
Delete the password from the root account
(You can also use the passwd command to reset the root password)
4. Restart reboot. the root password is blank.

Ii. GRUB boot
1. When the grub screen appears, select the Linux boot item and press E.
2. Select a line starting with kernel and press the e key. At the end of the line, press the Space key and enter single to exit the editing mode with the Enter key;
3. Press enter to return, and then press the B key to start, you can directly enter linux single user mode
4. VI/etc/passwd Delete the password in the root item (you can also use the passwd command to reset the root password here)
5. Restart reboot. the root password is blank.

3. boot a floppy disk in Linux
Enter linux single after boot appears. You can enter the single-user mode;
Modify or delete the root password;

4. Use a Linux system to install a disk
If you do not have a system boot floppy disk and the system boot Lilo and grub are deleted, you can only use the Linux system installation disk to restore the root password.
Start with the first Linux system installation disk. Enter the following command after the boot prompt is displayed:
OOT: Linux rescue
At this time, the system enters the rescue mode and completes as prompted:
1. Select the language and keyboard format;
2. Select whether to configure the NIC. Generally, the NIC configuration can be skipped because the network is not required;
3. Select whether to allow the system to search for the RedHat Linux system on the hard disk and choose to continue;
4. The system displays that the system on the hard disk has been found and mounted to/mnt/sysimage;
5. Enter the rescue status. You can reset the root password:
# Chroot/mnt/sysimage (make the system a root environment)
# Cd/mnt/sysimage
# Passwd Root

5. Remove the hard disk and attach it to another machine.
If you are not afraid of trouble, you can also detach the hard disk for Linux installation and mount it to other system environments. You can also modify the/etc/passwd file and save the modification;
Note:
1. There may be differences between single input methods and methods in different Linux systems, hoping to try it on your own;
2. In addition to the/etc/passwd file, you may also need to modify the/etc/shadow file, which is the projection file of the/etc/passwd password file.

Security

Compared with the traditional superuser model, this method has different advantages and disadvantages, both of which do not always show excellent performance. To encourage the use of root permissions to execute a separate command, sudo is better than opening a shell:
This reduces the total time spent on using the root permission and reduces the risk of not using the root command.
Provides useful audit traces. There is a separate Root Password (traditional model) that provides an additional layer of protection when an administrator's password is compromised. In any case, if the administrator (using sudo or su to become root) is attacked, attackers can generally obtain the root through an indirect attack.

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.