Skip to content

make installer with sudo-only access work and re-enable ssh-ng #550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Mic92
Copy link
Member

@Mic92 Mic92 commented Jun 9, 2025

Now that our nixos installers should have a fixed ssh-ng implementation,
it should be safe to re-enable it.

On top we now test the use-case of an installer that doesn't need kexec
but sudo explicitly.

@Mic92 Mic92 changed the title Sudo improvements make installer with sudo-only access work and re-enable ssh-ng Jun 9, 2025
# Switch to root user by copying authorized_keys.
if [[ ${isInstaller} == "y" ]] && [[ ${sshUser} != "root" ]]; then
# Allow copy to fail if authorized_keys does not exist, like if using /etc/ssh/authorized_keys.d/
runSsh "${maybeSudo} mkdir -p /root/.ssh; ${maybeSudo} cp ~/.ssh/authorized_keys /root/.ssh || true"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This scripts makes the assumption that the ssh key in /root are respected by the sshd and that the root user is allowed to login via ssh.

Now that our nixos installers should have a fixed ssh-ng implementation,
it should be safe to re-enable it.

On top we now test the use-case of an installer that doesn't need kexec
but sudo explicitly.
@Mic92 Mic92 force-pushed the sudo-improvements branch from 1434cb9 to 48f06de Compare June 9, 2025 16:54
@Mic92
Copy link
Member Author

Mic92 commented Jun 9, 2025

This should also simplify users who want to turn a Linux distribution without root login into a NixOS installer with a script.

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.

1 participant