Closed cyber-murmel closed 1 year ago
Do I read it correctly, that the key is hardcoded to be deployed to the root user? https://github.com/NixOS/nixops/blob/fc9b55c55da62f949028143b974f67fdc7f40c8b/nixops/deployment.py#L612
Is the code then using the generated ssh key for root, but the username specified in config? https://github.com/NixOS/nixops/blob/fc9b55c55da62f949028143b974f67fdc7f40c8b/nixops/backends/__init__.py#L77
Ah, a simple fix is to add the root authorizedKeys to the targetUser authorizedKeys
let
targetUser = "nixos";
in
{
...
deployment.targetUser = targetUser;
users.extraUsers."${targetUser}".openssh.authorizedKeys.keys =
config.users.extraUsers.root.openssh.authorizedKeys.keys;
...
}
Deploying with nixops, using a config where
deployment.targetUser
is not"root"
, works fine the first time, but fails the second time.The deployment log states
Is there any way to make it deploy the key to the
deployment.targetUser
?