# password recovery for FreeBSD 4.11



## m4rtin (Jul 15, 2010)

I have an older machine with FreeBSD 4.11 installed. The problem was, that I was unable to log in because I had no idea about login name or password. I booted into a single user mode(_boot -s_), mounted all partitions which were defined in _/etc/fstab_ file(_mount -a_) and changed root password using _passwd root_. However, before I realized this _mount -a_ thing in order to have access to passwd utility, I changed /etc/passwd file manually using ed editor. It looked like this:




However, as second field should be the password, I was still unable to log in using root/24680 or martin/24680 as username/password. Any ideas, why this didn't work? Or any additional questions if my explanation was unclear :OOO


----------



## kpa (Jul 15, 2010)

Use `% vipw` to edit the passwd file. Blank out the password field totally and save the file. Use `% passwd` to set a new password.


----------



## alp (Jul 15, 2010)

I'm not sure about FreeBSD 4.11 (I haven't touched this one), but usually you have to use vipw to edit passwd and master.passwd. In other case you should regenerate spwd.db and pwd.db by hand. In recent FreeBSD it is done by pwd_mkdb (8).


----------



## gordon@ (Jul 15, 2010)

/etc/passwd doesn't contain the passwords for security reasons. If it did have passwords, they would not be in clear text (as you tried there). Instead, use passwd(1) to set the root user password. As noted, the actual passwords are in /etc/master.passwd which is protected by permissions. If you look in there, you will see something like:


```
root:$1$uJvh97IT$adOI70yILt/tRvQxU83r8.:0:0::0:0:Charlie &:/root:/bin/csh
```

The second field there holding the hashed password (which I changed, it's probably not even valid anymore).


----------

