I was trying to setup a ssh connection to my pi 2 (model B, i.e., no inbuilt wifi) in headless mode from my ubuntu machine. I do not have a router. After multiple attempts of flashing and tweaking, the following worked,
- Add ssh file in /boot
- Uncommenting the following lines in /etc/dhcpcd.conf
profile static_eth0 static ip_address=192.168.1.23/24 static routers=192.168.1.1 static domain_name_servers=192.168.1.1
interface eth0 fallback static_eth0
After this it asks for
pi@192.168.1.23's password:
to which i supplied the default password for rpi
raspberry
but it keeps saying Permission denied, please try again.for three times after which it closes the connection. I tried this and this, but it would not work. Note that I do not have a windows machine or a hdmi-in enabled screen. I don't remember having this problem in earlier versions of raspbian. I am using 2018-11-13-raspbian-stretch-full.img.
$ssh pi@raspberrypi
as it would sayCould not resolve hostname raspberrypi: Name or service not known
. After making a static IP in /etc/dhcpcd.conf I was able to connect but now I think I am not getting access to the default user, hence it's not accepting the default password. – REVOLUTION Jan 10 '19 at 09:08ssh
in/boot
but into the boot partition. You should useraspberrypi.local
in most OS. See How to set up networking/WiFi – Milliways Jan 10 '19 at 09:13$ssh pi@raspberrypi
and$ssh pi@raspberrypi.local
. Since this problem did not occur before when I used this with windows + putty, I assumed it has something to do with the DHCP connection on my laptop hence I gave it a static IP. I dont know much about DHCP hence I avoid it :p – REVOLUTION Jan 10 '19 at 09:20ssh -vvv
as this will give more verbose output which help work out why permission is denied. You can disable passwords in sshd_config. – fcbsd Jan 10 '19 at 09:45$ssh pi@raspberrypi.local
and it started working fine with it. I think the problem was with my ubuntu machine dhcp earlier. Thanks! – REVOLUTION Jan 10 '19 at 11:54ssh
file get deleted from the first partition? I think I'm right in saying that after the SSH service has been started it should delete the file: thessh
file is a one-time option and is not persistent. I also see to remember reading somewhere recently that it only works on a fresh install as well, try re-writing the card and add yourssh
andwpa-supplicant.conf
to it before booting. – Roger Jones Jan 10 '19 at 17:12