Headless Pi 4B problems - continued

Jan 26, 2025 Last reply: 1 year ago 42 Replies

This is getting ridiculous!



Once upon a time one just copied an image to a card, enabled ssh and hey presto, you could log in as user pi with password raspberry.



No chance now.



I would point out that I'm not, in general, a complete numpty. I've been using Pis (and other similar things) for many many years.


So, having found out why the above simple approach doesn't work I have tried:-



Use rpi-imager, wasted first attempt because it wasn't obvious where one entered user/password. Second attempt seemed to boot the Pi OK but it never appeared on my LAN so not much help there. (At least my first dd copied image appeared on the LAN)



Manually editing userconf.txt with my /etc/shadow encrypted password from my Linux box got to a login prompt but the password is somehow wrong.



Finally I managed to get a login working by creating a ~/.ssh/authorized keys file with the public key from my Linux system in it. Phew!


Ah. There may be gotchas in there like EOL charaters and spaces that have to be 'just right'

I generally generate the encryption using the tools suggested.

e.g. echo 'mypassword' | openssl passwd -6 -stdin

echo 'raspberry' | openssl passwd -6 -stdin

$6$5H2l9s5V5YBulBGU$xchi.2AQLn5P5IK/khNPC3uggf9dc5DjY9KKxZK7IdDPNV1Zzggaxg0DTstT8bpSMvRzUlc9vJ/mrPQPbfBX/

Note you never get the same string twice...

Here is a userconf.txt with user pi password raspberry...

pi:$6$c70VpvPsVNCG0YR5$l5vWWLsLko9Kj65gcQ8qvMkuOoRkEagI90qi3F/Y7rm8eNYZHW8CY6BOIKwMH7a3YYzZYL90zf304cAHLFaZE0

Ultimately that is a smoother way to access the Pi anyway

I can offer some suggestions: use version 1.85 of the Imager program. It has solved some of the password entry issues of the older version. Also it allows you to use a different user name than pi, but I like pi so I use it. Use the latest Raspberry Pi OS, either 64 or 32 bit as appropriate.

knute...

That is the version I'm using.

It's just over-complicated for something which should really be quite simple.

Is there **really** such a big security issue with default login names and passwords on Raspberry Pis? Surely almost all of them are going to be on home networks behind NAT routers and also surely no one is going to (without thinking about it a bit!) put confidential data on one. Anyone installing any system which is going to be directly out on the internet should be very aware of the risks and will do what's required.

Plenty of Pis (especially the compute modules) end-up in industrial kit, maybe not much data on them, but you don't want them being used to laterally attack other systems.

formatting link

"Passwords must be— (a)unique per product; or (b)defined by the user of the product."

Ah, so it's legislation has caused this. :-)

Again I say, anyone who is actually deploying Pis in such a situation needs to know what they're doing. If they don't know what they're doing no amount of legislation is going to help much.

What really is getting to me is that the non-GUI user who wants to use a Pi (or arduino or BBB) to moinitor the temperature in his garage ends up having to jumpo through lots of unnecessary hoops to do it. To a significant extent it's because the Pi has become much more 'mass market'.

Oh well, I guess I can live with it. Rant over. :-)

I don't know but there appear to be a few people who can't get their password into their Pi successfully.

Most who cannot are people trying to use a foreign keyboard, which you cannot set up in the imager

There was a lot of back and forth about that on the Pi Forum last year. I and several other folks suggested that it would be a good idea to be able set your keyboard type in the Imager. And since I have one of those foreign (the default is en_UK) keyboards it can be tricky until you figure out what is going on.

Yes, not ideal, but you can always set a password that works with a UK keyboard, and then change it when you first connect

An RPi is overkill for a job like that. An ESP32 or Arduino will keep things simple at far lower cost.

Why would you be using a keyboard at all on a headless Pi?

Or a Pi Pico W. Cheaper than an Arduino, networks, has 3 ADC S. Its perfect

But a Pi is much more accessible (in the sense of being easy to access your data directly). It's just so much handier to communicate with, as in the case of my Pi running on a boat in France, it does all the work of connecting and so on as well as collecting data. In my case it also drives two displays.

... and it's not exactly expensive, £33 for a 1GB 4B and a lot less if you go for a Pi Zero.

I do have a couple of Arduinos and ESP32s but given that you really need another computer to access them and do anything useful with the data I always end up deciding that a Pi (or a BeagleBone Black) is just so much easier as a standalone system.

One of the reasons I have BeagleBone Blacks in my list of 'goto' devices is that they have seven ADC inputs available on board. Thus you have direct login like a Pi plus the ability to read voltages in a very straightforward way.

My organically growing network uses Picos to collect the data and a Pi Zero to receive it and display it and do what is needful with it.

If I wanted to store large quantities Id add maybe an SSD to the Zero. I think the USB port would recognise that.

UIs are wherever possible Web based.

This, exactly.

Yet another example of 'we know better than you' and 'make it easier for (some unknown version of) everyone'

Well my boat's system uses just an ancient Pi B+ and I2C to collect all the data, no other microcontrollers or anything.

I'm willing to accept they know better than me. I think it is the right way to go. i.e. Use a general provisioning script on first boot.

My main memory is the rPi imager also allowed headless Wifi set up, which had not be possible/easy previously. I can't remember if it worked?

Clearly to access the Pi from another computer. Running headless doesn't mean you don't way to access it

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required