How to change the root password and retrieve root password under Linux

Source: Internet
Author: User

Modify the root password method under Linux

Log in as root, execute:

passwd User Name

Then follow the prompts, enter a new password, enter the new password again, the system will prompt to successfully change the password.

Specific examples are as follows:

[Email protected] ~]# passwd rootchanging password for user root.  New UNIX Password:bad Password:it is based on a dictionary wordretype new UNIX Password:passwd:all authentication tokens Updated successfully.

Commands to add new users under Linux

Useradd User Name

Root password retrieval method under Linux

Linux Root has the supremacy of power, once the root password is forgotten or stolen, is a very headache, then how to retrieve the root password? I would like to summarize it as follows:

(a) Linux system password cracking

    1. Press E to enter edit mode on the GRUB Options menu
    2. Edit kernel that line/init 1 (or/single)
    3. Press B to restart
    4. After entering, execute the following command

[Email protected] #passwd root (config root password)
Enter new UNIX password: Enter the password
[Email protected] #init 6

(ii) Debian Linux system password cracking

    1. In the Grub Options menu ' Debian gnu/linux,... (recovery mode) ', press E to enter edit mode
    2. Edit kernel that row of RO single to RW single init=/bin/bash, press B to perform the restart
    3. After entering, execute the following command
[Email protected] (none) #mount-a[email protected] (none) #passwd Root[email protected] (none) #reboot

(iii) FreeBSD system password cracking

    1. Booting into the boot menu
    2. Select each entry (press 4) to enter single user mode
    3. Enter a list of commands after entering
[Email protected] #mount-a[email protected] #fsck-y[email protected] #passwd (Change password command) [email protected] #root (username to crack password) Enter new UNIX Password:[email protected] #init 6 (restart)

(iv) Solaris system password cracking bitscn.com

    1. Select the Solaris FAILASFE entry in the Grub Options menu
    2. The system prompts do you wish to have it mounted read-write on/a? [Y,n,?] Select Y
    3. into single-user mode
    4. Enter the following command
#passwd #new passwd: Enter a new password #re-enter passwd: Enter a new password at the time #init 6 (restart) bitscn.com

(v) NETBSD system password hack

1. Power on: When the prompt sign appears and start the countdown for five seconds, type the following command:

> boot-s (enter single-user mode command)

2. In the following hint symbol

Enter pathname of shell or RETURN for SH:

Press Enter.

3. Type the following command:

# mount-a# Fsck-y

4. Use passwd to change the root password.
5. Use the Exit command to enter multi-person mode.

(vi) Debian Linux system password cracking

    1. On the Grub boot loader menu, select the entry you want to enter, and type "E" to enter the edit mode;
    2. In the second line (similar to kernel/vmlinuz-2.6.15 ro root=/dev/hda2), type "E" into edit mode;
    3. At the end of the sentence add "Init=/bin/bash", enter;
    4. Press "B" to start the system.

So we can get a bash shell, after entering the shell, the mount mode of the root partition is read-only, we want to change it to writable, otherwise we cannot alter the root password:

Mount-no remount,rw/passwd rootsyncmount-no Remount,ro/reboot

This will successfully change the Debian root user's password.

Seven

1. When booting Linux, press CTRL X, enter Linux single or Linux 1 at the bash# prompt, and then enter passwd root in bash# to change the password! #init 6 restart OK after Setup.

2. When booting Linux, press CTRL x, enter at bash# prompt: vi etcpasswd, find root, put the "X" inside the root:x: .... Delete the password!

(eight)

First, about Lilo

    1. When you see the Lilo: prompt, type Linux single screen display Lilo:linux single
    2. Enter directly into the Linux command line
    3. Change the password with the password command

Ii. about GRUB

    1. When the Grub screen appears, use the up and down keys to select the one you normally start Linux on, and then press the E key
    2. Use the up and down keys again to select the one you normally start Linux (similar to kernel/boot/vmlinuz-2.4.18-14 ro root=label=/), and then press the E key
    3. To modify the command line you see now, add single and the result is as follows: kernel/boot/vmlinuz-2.4.18-14 single ro root=label=/single
    4. Enter the Linux command line by returning the carriage return and then pressing the B key to start
    5. Change the password with the password command

Nine

    1. Insert the system installation CD, restart the machine, start quickly press the DEL key, into the CMOS, the boot sequence to CD-ROM first start, so that the Linux installer started, press F5, follow the prompts to enter Linuxrescue Enter the rescue mode, followed by the choice of language and keyboard, Enter directly, the program tip has installed the Linux system on the hard disk/mnt/sysimage, and then there is a super user prompt #.
    2. Go to the hard disk etc directory: CD/MNT/SYSIMAGE/ETC, first backup to prevent accidents: Cpshadowshadow.old Modify the properties of the shadow file is writable: chmod Wshadow then use VI to modify: Find the line containing the root user information: root: ....:, the first two colon is an encrypted password, delete it (colon can not be deleted), save the log out. The root password is empty.
    3. Users who do not use VI can take the following approach: Find a DOS disk into the floppy drive, copy the shadow to the DOS disk: mcopyshadowa:/and then modify it with the Notepad in the attachment under Windows, note that opening the file type must select All Files (*. *), Save to exit. Copy back: mcopya:/shadowmnt/sysimage/etc
    4. Change the properties of the shadow back to read-only: Chmod-wshadow, enter exit to exit and remove the disc. For security reasons, you should re-add the root in the terminal window after rebooting.

How to change the root password and retrieve root password under Linux

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.