LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Forgotten username and password used during installation (https://www.linuxquestions.org/questions/linux-newbie-8/forgotten-username-and-password-used-during-installation-529272/)

bernadette 02-15-2007 08:03 AM

Forgotten username and password used during installation
 
Hi
I was helping a friend install Mandrake Linux Free 2006 and he entered a username and password for normal login and a root username and password. Unfortunately he could not remember exactly the spelling of the username he entered and we are left at the login screen with no means of entry. Is there anyway we can logon or do we need to do a reinstall?

bigrigdriver 02-15-2007 08:27 AM

You could re-install (write down the root password, user name and password so you don't forget them again).

You could also follow these instructions to wipe out the root password: http://www.unixguide.net/linux/faq/06.16.shtml. Then log in as root, set up a new root password (write it down). Then 'ls /home' to list the contents of /home, and get the spelling of the user name you set up.

Finally, set up a new password for the user (write it down).

pixellany 02-15-2007 08:31 AM

You have forgotten both the username/password AND the root password??
Did you try logging in as root?

Things to try:
1. At startup, when the GRUB screen is displayed, hit any key to stop the booting. You then have the option of editing the boot commands. Add the word "single" to the end of the line that starts with "kernel" and then boot. This should put you in a terminal mode without asking for a password.

2. Boot from the install disk and press ctrl-alt-F1 to get a terminal. In this mode, you will need to mount the Linux partition

Once you are running in a terminal, go to /etc and look for the "passwd" file. You can edit this with an editor---eg nano.
Command: nano /etc/passwd
Look for the root entry, and delete the "x"---so the entry looks something like this:
root::0:0::/root:/bin/bash
save the file and reboot. You will now be able to log in as root with no password. Now you can create a new password and a new user account.

wpn146 02-16-2007 01:01 AM

Some Unix flavors will demand a root password to reach single user mode. I know Solaris is one and I think some Linux distros are the same.

If your distro allows single user mode without a root password, you might want to edit your /boot/grub/grub.conf file (or /etc/lilo.conf if you are using lilo) after fixing the problem and create a new stanza there, essentially the same as the current one but with a new label (like "Linux single user") that already has the "single" or "1" appended. It will make it easier to run single user mode in the future.

If your distro will not let you in using single user mode without a password, then boot into rescue mode and mount your "/" partition at a convenient mount point (often the rescue mode will mount it at "/mnt/sysimage" for you.) Instead of editing /mnt/sysimage/etc/passwd (or whatever mount point you are using) I normally edit /mnt/sysimage/etc/shadow instead. The entry for "root" is normally the first line of the file. Remove everything between the first pair of ":"'s. For example, make:
Code:

root:abcdefghijkl0123456789:<whatever>
Look like:
Code:

root::<whatever>
If you can boot into single user mode without a password, then do the same editing except without the "/mnt/sysimage" part.

This will allow you to log in as "root" without a password. Once you are "root", you can put in a real root password with the "passwd" command.

jschiwal 02-16-2007 01:40 AM

From the first posting it sounded to me like it is the regular username and password that were forgotten.

If you remember the root password, the username of the regular user is the same as the directory name in /home/.
It is also listed in /etc/passwd. You can change the password then with the root command: passwd username


All times are GMT -5. The time now is 08:38 AM.