I am trying to set up a new, headless Pi 4B. I have copied the 'lite'
image to a USB drive and created the empty 'ssh' file in the boot
partition.
It boots OK and the ssh deamon is running but the default username
'pi' and password 'raspberry' don't work. How on earth do I get into
it to start it up?
I can edit files on the USB drive OK so I can add and modify entries
in /etc/passwd and /etc/shadow. So all I actually need to do is set it
up so the user 'pi' has no password but I'm not doing too well at
doing that at the moment.
Any ideas, or other ways to get into it?
I am trying to set up a new, headless Pi 4B. I have copied the 'lite'
image to a USB drive and created the empty 'ssh' file in the boot
partition.
It boots OK and the ssh deamon is running but the default username
'pi' and password 'raspberry' don't work. How on earth do I get into
it to start it up?
I can edit files on the USB drive OK so I can add and modify entries
in /etc/passwd and /etc/shadow. So all I actually need to do is set it
up so the user 'pi' has no password but I'm not doing too well at
doing that at the moment.
Any ideas, or other ways to get into it?
Any ideas, or other ways to get into it?
I can edit files on the USB drive OK so I can add and modify entries in /etc/passwd and /etc/shadow. So all I actually need to do is set it up
so the user 'pi' has no password but I'm not doing too well at doing
that at the moment.
On Sat, 25 Jan 2025 22:34:53 +0000, Chris Green wrote:
I can edit files on the USB drive OK so I can add and modify
entries in /etc/passwd and /etc/shadow. So all I actually need to
do is set it up so the user 'pi' has no password but I'm not
doing too well at doing that at the moment.
Try putting this in the password field in the /etc/shadow file:
$y$j9T$7FOBvVykAYTWGfCHpB2tJ.$/cOEl5X64TU2daBOxeP.hfgF90h23GeLBxFmJI0TVP4
(thats a hash for raspberry.)
The hash was produced with my code from here <https://gitlab.com/ldo/nixcrypt>. The various hash algorithms that
should be available are documented here <https://manpages.debian.org/crypt(5)>.
I am trying to set up a new, headless Pi 4B. I have copied the 'lite'
image to a USB drive and created the empty 'ssh' file in the boot
partition.
It boots OK and the ssh deamon is running but the default username
'pi' and password 'raspberry' don't work. How on earth do I get into
it to start it up?
I can edit files on the USB drive OK so I can add and modify entries
in /etc/passwd and /etc/shadow. So all I actually need to do is set it
up so the user 'pi' has no password but I'm not doing too well at
doing that at the moment.
Any ideas, or other ways to get into it?
On 25/01/2025 22:34, Chris Green wrote:
I am trying to set up a new, headless Pi 4B. I have copied the 'lite' image to a USB drive and created the empty 'ssh' file in the boot partition.
It boots OK and the ssh deamon is running but the default username
'pi' and password 'raspberry' don't work. How on earth do I get into
it to start it up?
I can edit files on the USB drive OK so I can add and modify entries
in /etc/passwd and /etc/shadow. So all I actually need to do is set it
up so the user 'pi' has no password but I'm not doing too well at
doing that at the moment.
Any ideas, or other ways to get into it?
Others have told you how to use the imager, but IIRC all that does is
set up a file in the VFAT partition....
Here is a shameless cut'n paste
Write the Raspberry Pi OS image to your SD card as normal
Mount the newly written /boot partition on the Pi on your computer
Create an empty file named ssh, without a file type / ending. On
Linux and macOS, this is easily done with touch ssh if you’re in the
right directory. This tells the OS to enable SSH access right away.
Next, create a user with a password on the SD card as that’s not
done automatically anymore.
Create an encrypted password for your new Raspberry Pi user. On Linux and macOS, this can be done with OpenSSL. For added security,
write the new password into a masked shell variable so it doesn’t show
up in your computer’s shell history:
[morph@void ~]$ read -s pw
[morph@void ~]$ echo "$pw" | openssl passwd -6 -stdin
$6$4E2z6hQOGLZCK5ZN$ESo2r/tO7Sy1Xmyp/bFzQ0A8zNNMhOoj0XocoGVbc8PVLcHlDr/kQiRvv/vOfdopLkylTVQSfK4n97SR9VGGF1
the long random string is your encrypted password. Next, create another file next to the ssh file on the SD card’s boot partition named userconf.txt.
Open userconf.txt with your favourite text editor and in the
first and only line enter your desired username and the encrypted
password, separated by a colon. It should look like this: morph:$6$4E2z6hQOGLZCK5ZN$ESo2r/tO7Sy1Xmyp/bFzQ0A8zNNMhOoj0XocoGVbc8PVLcHlDr/kQiRvv/vOfdopLkylTVQSfK4n97SR9VGGF1
And that’s it. Unmount your card, pop it into the Pi, connect it to your network and boot. You should now be able to SSH into it using your new credentials. No monitor needed.
On 1/25/25 22:34, Chris Green wrote:
I am trying to set up a new, headless Pi 4B. I have copied the 'lite' image to a USB drive and created the empty 'ssh' file in the boot partition.
It boots OK and the ssh deamon is running but the default username
'pi' and password 'raspberry' don't work. How on earth do I get into
it to start it up?
I can edit files on the USB drive OK so I can add and modify entries
in /etc/passwd and /etc/shadow. So all I actually need to do is set it
up so the user 'pi' has no password but I'm not doing too well at
doing that at the moment.
Any ideas, or other ways to get into it?
Use the Raspberry Pi Imager, it is good. That allows you to do some boot provisioning, this is a more up to date version of the ssh file in boot.
I think there is a .yml provisioning file, but I get confused between different OSes.
The other way is to use a .ssh/authorized_keys file, with an appropriate
key set up on the machine you are coming from.
In article <vn45o5$37klv$5@dont-email.me>,
Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
On Sat, 25 Jan 2025 22:34:53 +0000, Chris Green wrote:
I can edit files on the USB drive OK so I can add and modify
entries in /etc/passwd and /etc/shadow. So all I actually need to
do is set it up so the user 'pi' has no password but I'm not
doing too well at doing that at the moment.
Try putting this in the password field in the /etc/shadow file:
$y$j9T$7FOBvVykAYTWGfCHpB2tJ.$/cOEl5X64TU2daBOxeP.hfgF90h23GeLBxFmJI0TVP4
(that?s a hash for ?raspberry?.)
The hash was produced with my code from here <https://gitlab.com/ldo/nixcrypt>. The various hash algorithms that
should be available are documented here <https://manpages.debian.org/crypt(5)>.
Question if I may? How do you get to the /etc/shadow file if you
can't log in to the pi?
Probably a couple of years ago now I created my own userconf file
which along with an empty SSH file I drop into a newly burnt SD card.
This works just fine for me but I would love to know how get to
anything on the other partition without logging in. I am unaware of
any way to see the main partition when the SD card is plugged into a
PC.
On 25/01/2025 22:34, Chris Green wrote:
I am trying to set up a new, headless Pi 4B. I have copied the 'lite' image to a USB drive and created the empty 'ssh' file in the boot partition.
It boots OK and the ssh deamon is running but the default username
'pi' and password 'raspberry' don't work. How on earth do I get into
it to start it up?
I can edit files on the USB drive OK so I can add and modify entries
in /etc/passwd and /etc/shadow. So all I actually need to do is set it
up so the user 'pi' has no password but I'm not doing too well at
doing that at the moment.
Any ideas, or other ways to get into it?
There is no longer a default user in current images. When you sue the Raspberry Pi Imager, you must use the option to set a user and password,
and if needed to enable ssh
When you sue the Raspberry Pi Imager, you must use the option to set a
user and password
The Natural Philosopher <tnp@invalid.invalid> wrote:
On 25/01/2025 22:34, Chris Green wrote:I think an ssh key will be easier! :-)
I am trying to set up a new, headless Pi 4B. I have copied the 'lite'
image to a USB drive and created the empty 'ssh' file in the boot
partition.
It boots OK and the ssh deamon is running but the default username
'pi' and password 'raspberry' don't work. How on earth do I get into
it to start it up?
I can edit files on the USB drive OK so I can add and modify entries
in /etc/passwd and /etc/shadow. So all I actually need to do is set it
up so the user 'pi' has no password but I'm not doing too well at
doing that at the moment.
Any ideas, or other ways to get into it?
Others have told you how to use the imager, but IIRC all that does is
set up a file in the VFAT partition....
Here is a shameless cut'n paste
Write the Raspberry Pi OS image to your SD card as normal
Mount the newly written /boot partition on the Pi on your computer
Create an empty file named ssh, without a file type / ending. On
Linux and macOS, this is easily done with touch ssh if you’re in the
right directory. This tells the OS to enable SSH access right away.
Next, create a user with a password on the SD card as that’s not
done automatically anymore.
Create an encrypted password for your new Raspberry Pi user. On
Linux and macOS, this can be done with OpenSSL. For added security,
write the new password into a masked shell variable so it doesn’t show
up in your computer’s shell history:
[morph@void ~]$ read -s pw
[morph@void ~]$ echo "$pw" | openssl passwd -6 -stdin
$6$4E2z6hQOGLZCK5ZN$ESo2r/tO7Sy1Xmyp/bFzQ0A8zNNMhOoj0XocoGVbc8PVLcHlDr/kQiRvv/vOfdopLkylTVQSfK4n97SR9VGGF1
the long random string is your encrypted password. Next, create
another file next to the ssh file on the SD card’s boot partition named
userconf.txt.
Open userconf.txt with your favourite text editor and in the
first and only line enter your desired username and the encrypted
password, separated by a colon. It should look like this:
morph:$6$4E2z6hQOGLZCK5ZN$ESo2r/tO7Sy1Xmyp/bFzQ0A8zNNMhOoj0XocoGVbc8PVLcHlDr/kQiRvv/vOfdopLkylTVQSfK4n97SR9VGGF1
And that’s it. Unmount your card, pop it into the Pi, connect it to your >> network and boot. You should now be able to SSH into it using your new
credentials. No monitor needed.
Chris Townley wrote:
When you sue the Raspberry Pi Imager, you must use the option to set a
user and password
Last time I used it, it would let you enter "root" for the username,
but it wouldn't set the password for root.
Bob Latham <bob@sick-of-spam.invalid> wrote:
In article <vn45o5$37klv$5@dont-email.me>,
Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
On Sat, 25 Jan 2025 22:34:53 +0000, Chris Green wrote:
I can edit files on the USB drive OK so I can add and modify
entries in /etc/passwd and /etc/shadow. So all I actually need to
do is set it up so the user 'pi' has no password but I'm not
doing too well at doing that at the moment.
Try putting this in the password field in the /etc/shadow file:
$y$j9T$7FOBvVykAYTWGfCHpB2tJ.$/cOEl5X64TU2daBOxeP.hfgF90h23GeLBxFmJI0TVP4
(that?s a hash for ?raspberry?.)
The hash was produced with my code from here <https://gitlab.com/ldo/nixcrypt>. The various hash algorithms that should be available are documented here <https://manpages.debian.org/crypt(5)>.
Question if I may? How do you get to the /etc/shadow file if you
can't log in to the pi?
By editing it in the file system that appears when you plug the USB stick into a PC, easy! :-)
Probably a couple of years ago now I created my own userconf file
which along with an empty SSH file I drop into a newly burnt SD card.
This works just fine for me but I would love to know how get to
anything on the other partition without logging in. I am unaware of
any way to see the main partition when the SD card is plugged into a
PC.
Both partitions appear when I plug it into my Linux boxes, e.g. when
this particular USB is plugged in I see:-
/media/chris/Transcend/rootfs
/media/chris/Transcend/bootfs
On 26/01/2025 09:47, Chris Green wrote:
The Natural Philosopher <tnp@invalid.invalid> wrote:
On 25/01/2025 22:34, Chris Green wrote:
I am trying to set up a new, headless Pi 4B. I have copied the 'lite' >>> image to a USB drive and created the empty 'ssh' file in the boot
partition.
It boots OK and the ssh deamon is running but the default username
'pi' and password 'raspberry' don't work. How on earth do I get into
it to start it up?
I can edit files on the USB drive OK so I can add and modify entries
in /etc/passwd and /etc/shadow. So all I actually need to do is set it >>> up so the user 'pi' has no password but I'm not doing too well at
doing that at the moment.
Any ideas, or other ways to get into it?
Others have told you how to use the imager, but IIRC all that does is
set up a file in the VFAT partition....
Here is a shameless cut'n paste
Write the Raspberry Pi OS image to your SD card as normal
Mount the newly written /boot partition on the Pi on your computer
Create an empty file named ssh, without a file type / ending. On
Linux and macOS, this is easily done with touch ssh if you’re in the
right directory. This tells the OS to enable SSH access right away.
Next, create a user with a password on the SD card as that’s not
done automatically anymore.
Create an encrypted password for your new Raspberry Pi user. On >> Linux and macOS, this can be done with OpenSSL. For added security,
write the new password into a masked shell variable so it doesn’t show >> up in your computer’s shell history:
[morph@void ~]$ read -s pw
[morph@void ~]$ echo "$pw" | openssl passwd -6 -stdin
$6$4E2z6hQOGLZCK5ZN$ESo2r/tO7Sy1Xmyp/bFzQ0A8zNNMhOoj0XocoGVbc8PVLcHlDr/kQiRvv/vOfdopLkylTVQSfK4n97SR9VGGF1
the long random string is your encrypted password. Next, create >> another file next to the ssh file on the SD card’s boot partition named >> userconf.txt.
Open userconf.txt with your favourite text editor and in the
first and only line enter your desired username and the encrypted
password, separated by a colon. It should look like this:
morph:$6$4E2z6hQOGLZCK5ZN$ESo2r/tO7Sy1Xmyp/bFzQ0A8zNNMhOoj0XocoGVbc8PVLcHlDr/kQiRvv/vOfdopLkylTVQSfK4n97SR9VGGF1
I think an ssh key will be easier! :-)
And that’s it. Unmount your card, pop it into the Pi, connect it to your >> network and boot. You should now be able to SSH into it using your new
credentials. No monitor needed.
I didn't find it so.
Essentially you need to create a file userconf.txt with one line
user:<encrypted password>
in the root of the VFAT boot partition
And if you have a linux system already, you can cut and paste it out of your own /etc/shadow
Plus an empty file called ssh. Using 'touch ssh'
Hardly rocket science
Bob Latham <bob@sick-of-spam.invalid> wrote:
Question if I may? How do you get to the /etc/shadow file if you
can't log in to the pi?
By editing it in the file system that appears when you plug the USB
stick into a PC, easy! :-)
Probably a couple of years ago now I created my own userconf file
which along with an empty SSH file I drop into a newly burnt SD
card. This works just fine for me but I would love to know how
get to anything on the other partition without logging in. I am
unaware of any way to see the main partition when the SD card is
plugged into a PC.
Both partitions appear when I plug it into my Linux boxes, e.g. when
this particular USB is plugged in I see:-
/media/chris/Transcend/rootfs
/media/chris/Transcend/bootfs
By editing it in the file system that appears when you plug the USBErm, not here!
stick into a PC, easy! 🙂
My PC can read and write the FAT32 bootFS which is how I can add both
SSH and userconf files. But the other partition, ext4 rootfs is
invisible on my PC.
Chris Townley wrote:
When you sue the Raspberry Pi Imager, you must use the option to set a
user and password
Last time I used it, it would let you enter "root" for the username,
but it wouldn't set the password for root.
Before anyone makes the obvious claim, in my eyes a pi doesn't
qualify as a PC.
... openssl passwd -6 -stdin ...
More than that, it keeps alive some of the original spirit that has gone
from the Microsoft/Apple market: early PCs were hackable to some extent by users (remember when you got BIOS listings in the Technical Manuals?), but current proprietary machines effectively have a big sign across them
saying "No User-Serviceable Parts Inside" (and this applies to both
hardware and software).
Conversely, the Linux-running Raspberry Pi invites you to open it up and
mess around, both in terms of hardware and software. And this is
deliberate, by design.
It boots OK and the ssh deamon is running but the default username
'pi' and password 'raspberry' don't work. How on earth do I get into
it to start it up?
> It boots OK and the ssh deamon is running but the default username
> 'pi' and password 'raspberry' don't work. How on earth do I get into
> it to start it up?
Did you use the RPI Imager to create your SD card? You need to create a password for the pi user now. As far as I have seen it does not come with the password of 'raspberry' any more since they upgraded to bookworm ..
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,015 |
Nodes: | 10 (0 / 10) |
Uptime: | 68:11:27 |
Calls: | 13,252 |
Files: | 186,574 |
D/L today: |
703 files (232M bytes) |
Messages: | 3,335,419 |