{ config, ... }:
{
services.openssh = {
enable = true;
startWhenNeeded = true;
settings = {
PasswordAuthentication = true;
PermitRootLogin = "no";
X11Forwarding = true;
};
};
_.persist.files = map (key: key.path) config.services.openssh.hostKeys;
}
nixos
{ nixosConfig, config, ... }:
{
programs.ssh = {
enable = true;
enableDefaultConfig = false;
matchBlocks."*" = {
addKeysToAgent = "no";
compression = false;
controlMaster = "auto";
controlPath = "~/.ssh/master-%r@%n:%p";
controlPersist = "10m";
forwardAgent = false;
hashKnownHosts = false;
serverAliveCountMax = 3;
serverAliveInterval = 300;
userKnownHostsFile = "${nixosConfig._.persist.root}${config.home.homeDirectory}/.ssh/known_hosts";
};
};
}
home-manager