0

Following illness when Ubuntu part installed on 64 bit AMD system I now do not know my Log In, can this be recovered/changed, or shall I wipe the hard drive and start again?

I have reset the Password, but cannot get past Log In as it always says it is 'Incorrect' - this is meant to be the latest Ubuntu, 14.04 I believe

I am not asking about Password but Log In

Elder Geek
  • 36,023
  • 25
  • 98
  • 183

1 Answers1

1

There are several solutions:

  1. Change /etc/passwd from another Linux instance, found here:

    Warning: Only do this if you're in a reasonably safe environment (PC/laptop in home or office) etc - don't do it on a Internet connected, ssh enabled server especially if the username in question is something common (such as admin) as the short window without a password may allow unwanted access to your server.

    1. Boot the computer with a LiveCD (any reasonable distro will do).
    2. Mount the system's root (/) partition somewhere (/mnt maybe) - make sure it's mounted read/write as you'll be editing a file on it.
    3. Edit /etc/shadow as user root (using su or sudo).
    4. Find the entry for your user and remove everything between the first and second colon (:) - it's a long string of random looking characters.
    5. Save the changes, unmount the partition and reboot into your normal system.
    6. Login with no password.
    7. Quickly set your user's password.
    8. Log out and in and check it works.
  2. Use passwd, found here

    If you use passwd 16040 as root, it wont ask you about current password. You should consider, after changing password, to issue: chage -d 0 16040 It will enforce changing user password, when user will login. It is best practice for security reasons.

  3. Reboot and enter in passwordless mode, found here

    1. Reboot your computer / Turn your computer on.
    2. Hold down the Shift key at the start of the boot process to enable the GNU GRUB boot menu (if it does not show)
    3. Press ESC at the GNU GRUB prompt.
    4. Press e for edit.
    5. Use the Arrow keys to highlight the line that begins with kernel and press the e key.
    6. Go to the very end of the line and add rw init=/bin/bash
    7. Press Enter and then press b to boot your system.
    8. Your system will boot up to a passwordless root shell.
    9. Type in passwd yourusername
    10. Set your new password.
    11. Restart your system.
Zaka Elab
  • 165
  • 1
    Although your answer is 100% correct, it might also become 100% useless if that link is moved, changed, merged into another one or the main site just disappears... :-( Therefore, please [edit] your answer, and copy the relevant steps from the link into your answer, thereby guaranteeing your answer for 100% of the lifetime of this site! ;-) You can always leave the link in at the bottom of your answer as a source for your material... – Fabby Mar 18 '15 at 11:49
  • Edited according to your suggestions. Thanks ;) – Zaka Elab Mar 18 '15 at 15:26