nix-git/modules/ssh-server.nix
2023-09-17 16:46:46 +02:00

23 lines
605 B
Nix

{ config, pkgs, ... }:
{
# Enable SSH server.
services.openssh = {
enable = true;
#ports = [ 22 ];
# Use authorized keys only.
settings.PasswordAuthentication = false;
settings.PermitRootLogin = "prohibit-password";
# Enabling this is required for commands such as sftp and sshfs.
allowSFTP = false;
};
# SSH public key(s) allowed to connect via SSH.
users.users.yoda.openssh.authorizedKeys.keys = [
(builtins.readFile ../assets/ssh/nitrokey.pub)
];
users.users.root.openssh.authorizedKeys.keys = [
(builtins.readFile ../assets/ssh/nitrokey.pub)
];
}