If you are 100% sure that there is no mistake in your password (and no encoding issue?), could be that the user account is locked in the raspberry pi. When a user account is locked, login attempts are rejected as "Password incorrect", even if the password was correct.
Or, if you are trying to log in as root
, it could also be that ssh
is running with the option "no root", effectively locking the root
account when coming through ssh
.
EDIT/UPDATE Answering question in comment
if user account is locked, how can I fix it ?
Well... here you have basically two ways to proceed.
1. If you are in the system
NOTE: To alter anything of any other account that is not you, you need to perform the alteration as root
- To lock an account:
passwd -l <user>
- To unlock an account:
passwd -u <user>
Find more information about passwd
in the manpages (man passwd
)
2. If you cannot access the system (but can alter the contents of the file system)
You are talking about Raspberry Pi2, so it means that you have your system for the Raspberry somewhere in your computer and you flash it to the Raspberry Pi.
If you were talking about a general computer, you would need to proceed with a LiveCD/LiveUSB and mount the system you want to alter.
But the procedure is the same.
NOTE: Treat /
as the root (/
) of your target system from now on.
Assuming your target system uses shadow
file, the field reserved for the password hash in /etc/passwd
contains x
and the hash is actually in /etc/shadow
.
If this hash is preceeded by an exclamation mark (!
), it means that although the account is password protected, the account is locked. Remove this exclamation mark to have again the account unlocked when you boot into the system again (in the case of Raspberry Pi or any other embedded system, you need to flash this change into the module, of course)
Find more information about shadow file format here