yuri1993
Posts: 16
Joined: Sun Oct 27, 2013 10:11 pm

Can no longer SSH Permission denied (publickey,password)

Mon Dec 02, 2013 2:42 pm

I usually SSH into my pi through a bridge connection (ethernet conencts laptop and pi together) and use an ip scanner to find the ip address and login. I've done this in 4-5 locations with little to no problems.

I moved my pi again last night but this time when i try to login it asks me for the password and I get "Permission denied (publickey,password)" my password is the default "raspberry" and I haven't changed the sd card or password.

I've looked at other threads online and tried there solution but none work, from what I understand there is a mismatch between my ip and my key and so SSH isn't allowing me to login. I've tried using the

Code: Select all

$ ssh-keyscan 192.168.1.100 >> ~/.ssh/known_hosts
command to add the list to my hosts file but it doesn't work.

User avatar
Thijxx
Posts: 86
Joined: Mon Oct 22, 2012 1:25 pm
Location: The Netherlands

Re: Can no longer SSH Permission denied (publickey,password)

Thu Dec 05, 2013 10:00 am

Hi Yuri,

If your using a Linux client:
Can you check SSH is still waiting for a connection by using this:

Code: Select all

nmap -p22 <the pi's IP here>
For the Windows client:

Code: Select all

telnet <the pi's IP here> 22
If it's there, waiting for you; please connect again using -v at the ssh command so you get more information on what goes wrong and post it here.

Cheers, Thijs
Mimi: Where'd you come from?
Doyle: My mom and the authorities are still trying to figure that out.

User avatar
jojopi
Posts: 3737
Joined: Tue Oct 11, 2011 8:38 pm

Re: Can no longer SSH Permission denied (publickey,password)

Thu Dec 05, 2013 11:44 am

yuri1993 wrote:I moved my pi again last night but this time when i try to login it asks me for the password and I get "Permission denied (publickey,password)"
That means your password was rejected. It is not a network or host-key problem.

There are three possibilities. You may accidentally be connecting to the wrong machine; it is running SSH, but it is not the the Pi, so it does not accept the same password. Alternatively, you are giving the wrong password. Or the right password but the wrong username.

For security reasons, sshd does not tell the client whether it is the username or password that is wrong. The only way to tell is to check /var/log/auth.log on the Pi, which will also confirm that you are connecting to the correct box.

User avatar
default_user8
Posts: 680
Joined: Mon Nov 18, 2013 3:11 am

Re: Can no longer SSH Permission denied (publickey,password)

Sun Dec 08, 2013 3:36 am

Make things easy on yourself and give your pi a static IP address. There is code to do it from your pi or just log into your router and do it there. Either way you'll always know it no matter what and if you are logging in from a Linux machine you can write a SSH config file that will let you type SSH (keyword here) and log in.
Two heads are better than one, unless one's a goat head.

User avatar
BobDeBexar
Posts: 1
Joined: Sat Sep 06, 2014 5:13 pm

Re: Can no longer SSH Permission denied (publickey,password)

Sat Sep 06, 2014 5:25 pm

Check your keyboard layout in raspi-config.
UK is the default.
So when you set your password on the raspberry it may have not used the characters that you expected.
For instance, shift-2 is ", not @ in the UK layout. ...ask me how I know! :oops:
Hope that helps. :)

gdt
Posts: 85
Joined: Thu Jul 19, 2012 10:19 am

Re: Can no longer SSH Permission denied (publickey,password)

Mon Sep 08, 2014 5:42 am

Check that you are using the right userid by giving it on the command line:

Code: Select all

ssh pi@192.0.2.1
Please do change your password (see the passwd command). If your machine is accessible from the Internet (ie: you have a public IP address, not a NATed one) then it will last about a day before a brute-force scanner logins into it and commences evil.

You might also want to read about "SSH public keys" so that you can turn off SSH access via passwords all together.

If you move the Pi a lot then activate IPv6 (delete /etc/modprobe.d/ipv6.conf) and use the IPv6 link-local address to log in across the same subnet. That address never changes for each RPi. The RPiF really missed a trick not enabling IPv6 by default and printing the IPv6 link-local address on the box (it's derived from the MAC address, which they already print on the box).

mohitatpi
Posts: 1
Joined: Mon Oct 16, 2017 7:18 am

Re: Can no longer SSH Permission denied (publickey,password)

Mon Oct 16, 2017 7:36 am

I was facing same issue later I found that I doing ssh on wrong IP Address, to find raspberry pi IP use:

Code: Select all

cat /var/lib/misc/dnsmasq.leases
this will return something like:

Code: Select all

1658148373 ff:ff:ff:ff:ff:ff 10.42.0.221 raspberrypi ff:ff:ff:ff:ff:ff:ff 
Use this IP address to ssh to pi:

Code: Select all

ssh pi@10.42.0.221
on first login you will get a security warning, just type yes & login with password "raspberry", this may work

sergiu3
Posts: 1
Joined: Tue Dec 26, 2017 2:40 pm

Re: Can no longer SSH Permission denied (publickey,password)

Tue Dec 26, 2017 2:44 pm

Hey,
I had a similar problem getting denied on ssh to my pi.

What worked for me was just specifying the login name in the command:

sudo ssh -l pi 192.168...etc

It went straight through like that. Without the -l argument it kept saying permission denied.

Hope it helps.

Cheers!

JakoobCZ
Posts: 6
Joined: Sat Apr 23, 2016 10:08 am

Re: Can no longer SSH Permission denied (publickey,password)

Sat Jan 20, 2018 3:33 pm

on the latest Raspbian Stretch I also had to use for SSH

ssh -l pi 192.168.... otherwise I got permission denied. Wtf is that? :shock:

SurferTim
Posts: 2054
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: Can no longer SSH Permission denied (publickey,password)

Sat Jan 20, 2018 3:44 pm

WTF is that? What username are you using on the computer you are attempting to connect with? Is that user "pi"? If so, then this will work:
ssh 192.168.0.2

If not, then you must specify the user, like this:
ssh pi@192.168.0.2
or
ssh -l pi 192.168.0.2
My advice applies to RaspiOS only. Please mention if you use another OS.

Return to “Networking and servers”