-1

I lost the root password. So I modified /etc/shadow and also changed '/etc/inittab' file to access single user mode. But both didn't work. It asked me for a password that I don't have. Why updating the two files doesn't work?


I mount the file system, then overwrite the old shadow file with a new shadow file. I'm sure the password hash and format is right. But sometimes I receive error msg like this:

" EXT4-fs error (device vda1): ext4_mb_generate_buddy: EXT4-fs: group 0: 22415 blocks in bitmap, 22416 in gd Login timed out after 180 seconds "

or error msg like this:

" [/sbin/fsck.ext4 (1) -- /] fsck.ext4 -a /dev/vda1 /dev/vda1 contains a file system with errors, check forced. /dev/vda1: Duplicate or bad block in use! /dev/vda1: Multiply-claimed block(s) in inode 131094: 558941 "

Michael Hampton
  • 237,123
  • 42
  • 477
  • 940
Purres
  • 239
  • 1
  • 4
  • 18

1 Answers1

4

How did you "modify /etc/shadow"? You should be able to copy a user's password hash from /etc/shadow from one a system on which you know the password "works" to this server's /etc/shadow and have it Just Work (TM).

Oh, and don't edit /etc/shadow directly. Instead, use vipw -s. That will help prevent you from saving the file with formatting errors.

EEAA
  • 108,414
  • 18
  • 172
  • 242
  • Looks like the moderator moved my reply to the top. Do you have a resolution to the issue based on the way I operate shadow file as described above? – Purres May 30 '13 at 02:04