Skip to content

Unlock account when SSH public-key is set#908

Open
stefanb2 wants to merge 1 commit into
RPi-Distro:masterfrom
stefanb2:topic-allow-ssh-login
Open

Unlock account when SSH public-key is set#908
stefanb2 wants to merge 1 commit into
RPi-Distro:masterfrom
stefanb2:topic-allow-ssh-login

Conversation

@stefanb2
Copy link
Copy Markdown
Contributor

@stefanb2 stefanb2 commented Mar 3, 2026

Commit 4b9cd15 breaks public-key SSH configuration.

Make sure first user has a shell when PUBKEY_SSH_FIRST_USER is set.

@XECDesign
Copy link
Copy Markdown
Member

One of the first things build.sh enforces is that if you disable first user rename, you must set a password. If you ssh in while first boot wizard is running in the background, you'll end up in a bad situation. I can't find the issue report now, but that's why this commit was added in the first place - someone modified an image to enable ssh, added their key, sshed in, then ran though the wizard while logged in as the temporary first user.

Also, with a recent change that disables passwordless sudo by default, not setting a password can lock you out from doing anything useful on your system once you're in.

I'm not against the PR, but it needs to be done in a way that prevents such issues.

@stefanb2
Copy link
Copy Markdown
Contributor Author

stefanb2 commented Mar 3, 2026

I guess that makes sense from the Raspberry Pi Imager use case, but then PUBKEY_SSH_FIRST_USER & friends should be removed too, because they no longer work.

Let rework this.

Commit 4b9cd15 breaks public-key SSH
configuration.

Make sure first user has a shell when PUBKEY_SSH_FIRST_USER is set.
@stefanb2 stefanb2 force-pushed the topic-allow-ssh-login branch from ec30d7a to 5bda5e7 Compare March 3, 2026 12:53
@stefanb2 stefanb2 changed the title Add FIRST_USER_ALLOW_SSH_LOGIN option Unlock account when SSH public-key is set Mar 3, 2026
@stefanb2
Copy link
Copy Markdown
Contributor Author

stefanb2 commented Mar 3, 2026

I realized that a new option isn't required at all and moved the code behind the PUBKEY_SSH_FIRST_USER conditional in stage2.

As build.sh only allows FIRST_USER_PASS to be unset when DISABLE_FIRST_BOOT_USER_RENAME is set to 0, your first concern should be addressed by this updated PR.

Passwordless sudo is a separate case. I.e. I'm aware that I have to enable that option during the next upstream rebase of my branches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants