LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Unable to login. Doesnt accept password. (https://www.linuxquestions.org/questions/linux-newbie-8/unable-to-login-doesnt-accept-password-723107/)

veerloh 05-02-2009 05:19 AM

Unable to login. Doesnt accept password.
 
Hello Everyone

I have dual boot windowsxp Sp2 and Fedora 8 (2.6.23.1-42,fc8).I changed my root password by the following method:
1. boot linux kernel: init=/bin/sh
mount -o remount,rw /
/usr/bin/passwd

after changing my root password it said 'Authentication token updated sucessfully'

The problem now is i am unable to login either as a root or as a normal user.It doesnt accept any of the user passwords including root. So I then tried the following method to change my root password.

2. booting kernel: runlevel 1 (single user mode)
passwd : It says'changing passwd for user root.
unix_chkpasswd[1485]: check pass; user unknown.
passwd : Authentication token manipulation error.

So am not able to change the password this way.

Also i tried reading other similar threads and found a way to do it by modifying etc/passwd file. But to my dissappointment cannot make changes in /etc/passwd file when i login into single user mode. when i type command 'who' i get no response other than the prompt.when i do 'su' my prompt changes to [root@null]#

Now i dont know how to log into my system.
Please help me.

Disillusionist 05-03-2009 04:40 AM

Quote:

unix_chkpasswd[1485]: check pass; user unknown.
Doesn't sound good (especially with the root account).

Boot into single user mode and ensure that the root account exists:
Code:

grep '^root:' /etc/passwd
grep '^root:' /etc/shadow

The first command should show:
Quote:

root:x:0:0:root:/root:/bin/bash
The second should show something like:
Quote:

root:$1$raNd0M$tR1ng:13813:0:99999:7:::
Do not post the encrypted password (second field in the second output)

veerloh 05-03-2009 10:07 PM

Thanks for replying. I had lost the hope of getting any reply.

Sorry to reply so late.

before i enter the single user mode, it prints
MAKE DEV: no such user as root
MAKE DEV: no such user as root

id: Cannot find name for user ID 0

After entering the single user mode i typed the following commands and got this:

sh-3.2# grep |^root:' /etc/passwd
>

sh-3.2# grep |^root:' /etc/shadow
>

Absolutely nothing other than the greater than sign.!!!

Also when i do su, it says su: user root does not exist

I am so screwed. what should i do?
Thanks.:(

Disillusionist 05-04-2009 02:29 AM

Please have a look again at my example.

I did not use the | (pipe) symbol but an ' (openning single quote)

The reason your command continued the way it did, was because it only had one ' symbol on the line and thought you wanted to continue onto the next line.

EDIT:
If there really is no root user in these files.
You need to add an entry for root in /etc/passwd and /etc/shadow
As I am not sure if you know how to use vi, I am going to append the entries to the files by redirecting echo statements to append to the file.

Make backups of these files first.
Code:

cp -p /etc/passwd /etc/passwd.20090504
cp -p /etc/shadow /etc/shadow.20090504
echo "root:x:0:0:root:/root:/bin/bash" >> /etc/passwd
echo "root:$1$raNd0M$tR1ng:13813:0:99999:7:::" >> /etc/shadow
diff /etc/passwd /etc/passwd.20090504
diff /etc/shadow /etc/shadow.20090504

Then reset your root passwd:

Code:

passwd

veerloh 05-04-2009 03:46 AM

Certainly got the syntax wrong!

Will check and let you know later as i am at work.

Thanks

veerloh 05-04-2009 11:48 AM

Got an output!
 
I just checked the following commands in single user mode:

grep '^root:' /etc/passwd
root:x::0:root:/root:/bin/bash

grep '^root:' /etc/shadow
root::14363:0:99999:7:::

The second field in the second output is as it is. It is blank

What else should i try out. Please let me know.
:(

Disillusionist 05-04-2009 03:16 PM

The second field in the /etc/shadow file should contain the encrypted password.

If you modify the /etc/shadow entry for the root account to:
Quote:

root:$1$Ab2S4$wqTstArvWel4bnUz4keGN.:14363:0:99999:7:::
That should set your root password to TestPass1

Once you have managed to log in with the root account, you can change the password ;)

veerloh 05-04-2009 10:16 PM

Hi,

I changed the second field in the /etc/shadow entry for the root account to:
root:$1$Ab2S4$wqTstArvWel4bnUz4keGN.:14363:0:99999:7::: As you had mentioned.
by vim editor.

And the output grep '^root:' /etc/shadow shows root:$1$Ab2S4$wqTstArvWel4bnUz4keGN.:14363:0:99999:7:::

But am still not able to login as root. When i try to do su - root
it says 'user root does not exist'

And when i try to login through the console mode it says wrong username or password though i gave password as TestPass1.

And i noticed something during boot, it prints 'cannot open database infomation for current process UID'. Unknown user??? no memory or space to allocate. Can this help!

Thanks. Please let me know what do do?

Disillusionist 05-05-2009 12:14 AM

Do you have SELINUX turned on?

I think it's on as the default in Fedora.

Please post the contents of /etc/sysconfig/selinux

veerloh 05-05-2009 02:37 AM

Fine...

will check and let you know later in the evening, after work

Thanks for replying.

veerloh 05-05-2009 11:03 AM

Hi Disillusionist, Back again...

I tried the following in single user mode.
sh-3.2#/etc/sysconfig/selinux
sh: /etc/sysconfig/selinux:permission denied

Thanks once again for replying. I am so screwed, cannot login to my system.
Please help.

Disillusionist 05-05-2009 01:19 PM

Try:

Code:

cat /etc/sysconfig/selinux
modify the entry for:
Quote:

SELINUX=
to be:

Quote:

SELINUX=disabled
Then reboot


EDIT:

Try changing the root entry in /etc/password first (as per the following post)

Disillusionist 05-05-2009 03:14 PM

Just noticed something in one of your previous posts:
Quote:

Originally Posted by veerloh (Post 3529716)
I just checked the following commands in single user mode:

grep '^root:' /etc/passwd
root:x::0:root:/root:/bin/bash

Should be:

root:x:0:0:root:/root:/bin/bash

If your entry wasn't a typo, then that would explain why you cannot log in as root.

veerloh 05-05-2009 11:00 PM

Hurray!
 
What a delight. I am able to log into my system finally.

Thank you so much Disillusionist, really appreciate your efforts.

I did exactly what you said and was able to log in. And later i tried to modify the /etc/sysconfig/selinux to enforcing, just to see if it will work too and it did.

However am not able to change the user passwd
passwd VeeR
passwd:user Veer does not exist

Also the users which i delete and recreate again with the same name leads me to a failure. it says skel dir cannot write into the home directory of that user.

So i tried to delete the home directory for that user but could not. its not an empty directory. SO tried rm -rf to all files in that particaular dir which worked but two directories are still remaining.Which are
.
..

How should i do it?


THanks once again

Disillusionist 05-06-2009 12:49 AM

If you run:
Code:

ls -l /home
Please post the output and also grep /etc/passwd /etc/shadow for the relevant user names (same as you did for the root account)

EDIT:
Please continue onto next Page ;)


All times are GMT -5. The time now is 03:58 AM.