Skip to content

Doesn't copy authorized_keys from /etc/ssh/authorized_keys.d/${sshUser} #613

@DerRockWolf

Description

@DerRockWolf

My custom installer ISO has authorized keys for the nixos user set via users.users.nixos.openssh.authorizedKeys.keys but none for root.
In such cases it would be helpful if nixos-anywhere would additionally try to copy over the authorized_keys file from /etc/ssh/authorized_keys.d/$USER.

# Installation will fail if non-root user is used for installer.
# 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"
sshConnection="root@${sshHost}"
fi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions