Last active
February 1, 2025 17:32
-
-
Save m1cr0man/d7165e57e13aca77fde3a61527a40da4 to your computer and use it in GitHub Desktop.
SSH to a nixos test container
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This gist pertains to entering test VMs within nixpkgs/nixos/tests | |
# They must be run with driverInteractive in order to keep them around | |
# Use this in your test VM node configuration to enable ssh and root login | |
{ | |
services.openssh = { | |
enable = true; | |
settings.PermitRootLogin = "yes"; | |
}; | |
# Password will be "testingpain" | |
users.users.root.hashedPassword = "$6$LXJZIXCXOFNlhzc5$NYtb4ThIXAf4tcmIZB9D0b8r4Dj52JH0WU1ZwdVXdp0lQRZBU7I7dw.6ojLZY/bpxKTqYokIvqTZA.JGKXuVY/"; | |
users.users.root.hashedPasswordFile = null; | |
users.mutableUsers = false; | |
virtualisation.forwardPorts = [{ from = "host"; host.port = 2222; guest.port = 22; }]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null root@localhost -p 2222 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment