# Login incorrect



## Chris322P (Mar 24, 2011)

Hello,

I have a problem: FreeBSD tells me that my password is wrong. Every time I tried to change the password but it does not work. I can't connect via *sftp* and after I connect with *ftp* then I can no more connect with *ftp* again. So what now?

Chris


----------



## jrm@ (Mar 25, 2011)

Do you have the root password and can you login or su to root with a different account?  If so, you can change the user's password.

`# passwd chris322p`, assuming the username is chris322p.

If you don't have root's password, but have access to the console, you can reboot into single user mode and set the root password, or just run the passwd command above.


----------



## johnpeeb (Apr 1, 2011)

Could you provide a bit more detail? Are you saying you are having trouble logging in via SFTP, and that it tells you your password is wrong when you try and do that, but you can still log in via the terminal when you are physically at the machine?

If so, are you able to ssh into the machine? From the terminal, try [CMD="ssh"]localhost[/CMD] and see if you are able to successfully log in. Judging from the fact that sftp doesn't work, this will probably fail.

If so, please say what sort of error you are getting. Do you get a login prompt at all? If so, are you trying to log in as root? Posting a copy of your /etc/ssh/sshd_config might help.


----------



## SIFE (Apr 5, 2011)

May be you had been blocked, or you don't have permission to log in any more, may be SFTP/FTP services are down, all this possibly, try to log in as root and see what happen.


----------



## mamalos (Apr 5, 2011)

Check if your user's password has expired. It's the 6th field of /etc/master.passwd and there are a few entries regarding account/password expiration in /etc/login.conf. Also perform a *vipw* to see that everything is correct with regard to your user. As *SIFE* stated, your user might get locked for some insane reason; you will be able to see it in the password field of *vipw* (it's the same as looking at the /etc/master.passwd, but if you make a change with *vipw* the relative db files are also updated, so your changes take effect. This is not something that happens if you change /etc/master.passwd directly, and this is why you shouldn't). In case you change something in /etc/login.conf, don't forget to run:

`#  cap_mkdb /etc/login.conf` 

otherwise your changes will not take effect (works the same way with /etc/master.passwd).

Good luck.


----------



## soul_assassins (Sep 8, 2011)

I have a similar problem, I can't log in as root. Tried to do this:
enter in single mode and then enter:

```
fsck /
fsck /usr
/sbin/mount -w /
/sbin/mount -w /usr
passwd root
[enter passwd and confirm them]
pwd_mkdb: /etc/spwd.db.tmp: inappropriate file type or format
passwd: pam_chauthtok(): error in service module
```

Tried to do this: 

```
pw usermod root -h0
[enter passwd]
pwd_mkdb: corrupted entry
pwd_mkdb: /etc/master.passwd: inappropriate file type or format
pw: passwd file update: no such file or directory
```

So what is it?

OS: FreeBSD 8.2 release.

```
ls -l /etc/master.passwd
-rw------- 1 root wheel 2174 Sep 8 17:43 /etc/master.passwd
ls -l /etc/passwd
-rw-r--r-- 1 root wheel 1978 Sep 8 17:43 /etc/passwd
```


----------

