Subject: Pi5 Installation v 3.21 from SD - need initial password for root (SSH)

From: Gerald Pechoc <[email-masked]>
Date: Thu, 16 Jan 2025 00:45:44 +0100

Hi,

I tried to install Alpine Linux 3.21 from SD-Card on Pi5. The card was 
prepared with Pi-Imager.
All seems to work fine, Pi is booting and because of DHCP-fix address I 
could start SSH root@[ip-addr] but the hint I found very frequently in 
internet search results – user root, no password – is no longer valid 
for version 3.21.

Does anybody know which is the correct password for the installation?
I have guessed some passwords, but I was not very lucky with that.

Many thanks
Gerald

---

From: Pete French <[email-masked]>
Date: Fri, 17 Jan 2025 10:38:55 +0000

On 15/01/2025 23:45, Gerald Pechoc wrote:
> All seems to work fine, Pi is booting and because of DHCP-fix address 
> I could start SSH root@[ip-addr] but the hint I found very frequently 
> in internet search results – user root, no password – is no longer 
> valid for version 3.21.
>

sshd wont allow root logins by default. go in on the console (where 
empty root password should work fine) and then edit /etc/ssh/sshd_config 
and uncomment the line "PermitRootLogin" and set it to "yes". Restart 
sshd and now you should b able to loign. I havent yried this with no 
root passwor,d but it works for having a normal root password set (so 
maybe set one when you are in on the console as well, having gone to the 
trouble of connecting a screen and keyboard)

cheers,

-pete.

---

From: "fossdd" <[email-masked]>
Date: Thu, 16 Jan 2025 01:00:36 +0100

> I have guessed some passwords, but I was not very lucky with that.

I'm pretty sure it's still having no password. Are you sure you're
connecting to the correct machine?

Can you maybe connect with a display to the rpi and troubleshoot
further?

---

From: macmpi <[email-masked]>
Date: Fri, 17 Jan 2025 13:16:37 +0100

Hi Gerald,

Do you intend to ssh connect on initial Alpine startup, before any prior
setup?
Unlike Pi OS, Alpine is not configured for this by default: you need to
set it up.
(ref: previous comments)

There's a pre-made apkovl file which can seamlessly do this for you:
https://github.com/macmpi/alpine-linux-headless-bootstrap
It does allow passwordless root login; may be secured with
authorized_keys too.

On Alpine 3.21 make sure you use latest 1.2.3 version for successful ssh
login.

---

From: Jeffrey Walton <[email-masked]>
Date: Wed, 15 Jan 2025 19:06:50 -0500

> connecting to the correct machine?

Yeah, that's what the Alpine docs say, too:
<https://wiki.alpinelinux.org/wiki/Raspberry_Pi>.

> Can you maybe connect with a display to the rpi and troubleshoot

I would run `setup-alpine` before troubleshooting. I suspect the empty
password may be the problem. Once a new user is setup with a password
or public key, then SSH should work fine.

Jeff

---

From: Gerald Pechoc <[email-masked]>
Date: Tue, 21 Jan 2025 17:03:19 +0100

I want to say “thanks” to all who answered to my question.

In the end, I solved the problem using the second port of my screen and 
a free cable of a keyboard/mouse switch to start my first installation 
of Alpine Linux. Now I have it running on a RasPi 3B+ and I am delighted 
with this minimalistic system.

Only to find documentation is rather difficult.
But for my next problem, I make a new mail with appropriate subject line.

Gerald

-- 

....................................................................
Gerald Pechoc
Engineer for Telecommunications
and Electronics
aut.social/@kreativnix
[email-masked]
+43 680 215 15 19

---

From: Stuart Longland VK4MSL <[email-masked]>
Date: Sat, 18 Jan 2025 14:08:37 +1000

> internet search results – user root, no password – is no longer valid 

Nor should it ever be valid.  Password authentication on the `root` 
account is a major security issue.  Password authentication using an 
empty password for the `root` account is asking for trouble.

0. Generate a SSH keypair (`ssh-keygen`) and have the public key handy 
(it'll be a long string starting with "ssh-${ALGO}")
1. Create a non-root user with a non-empty password on the Pi if you 
have not already done so.  Ensure that the `~user.ssh` directory exists.
2. `scp /path/to/your/key.pub user@[ip-addr]:.ssh/authorized_keys`, 
verify that you can log in using your SSH key using `ssh user@[ip-addr]`.
3. Log in as `root` on a console on the `pi`; then run these commands:
    # mkdir /root/.ssh
    # cp ~user/.ssh/authorized_keys /root/.ssh
    # chown -R root:root /root/.ssh
    # chmod 0600 /root/.ssh/*

Now, try logging in as `root@[ip-addr]`, you'll now be able to log-in 
using public key authentication using your private key.
-- 
Stuart Longland (aka Redhatter, VK4MSL)

I haven't lost my mind...
   ...it's backed up on a tape somewhere.