DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2009-02-17 23:16:30

JediSthlm
Member
Registered: 2009-01-17
Posts: 19

Reset root password for chrooted Debian

I followed the wiki to install a chrooted Debian that worked fine. I was able to log in with ssh and root user with the default passsword (12345678). Yesterday it stopped working and wonder how I can reset the root user. My shadow file is empty and the passwd file looks like this:

------------
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
sshd:x:100:65534::/var/run/sshd:/usr/sbin/nologin
jedisthlm:x:1000:1000:Jens,,,:/home/jedisthlm:/bin/bash
messagebus:x:101:103::/var/run/dbus:/bin/false
avahi:x:102:104:Avahi mDNS daemon,,,:/var/run/avahi-daemon:/bin/false
--------------

Offline

 

#2 2009-02-18 00:39:59

silversurfer
Member
Registered: 2008-07-20
Posts: 95

Re: Reset root password for chrooted Debian

"man 5 passwd" says that if a user has an "x" in the field behind the user name the password of that user is stored in the shadow file. If there is no corresponding line in the shadow file then the user account is invalid. I think that this is the problem on your machine.

The manpage also says that if that field in passwd is blank the user has no password but this could cause problems with certain applications. You can try removing the "x" behind "root:" and see if you can login without a password.

This will only solve a bit of the real problem. You could get root access again but what about the other accounts in your passwd file? All of them are invalid if your shadow file is empty. It would probably be best if you could restore the shadow file from somewhere.

Offline

 

#3 2009-02-18 09:44:20

JediSthlm
Member
Registered: 2009-01-17
Posts: 19

Re: Reset root password for chrooted Debian

@silversurfer: Thanks for reply, then I also understood the manpages correctly. I wonder what have happened. I'll see if I can find an copy of the shadow file somewhere

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB