Set LoginGracetime in SSH server config


I would like to set the LoginGracetime setting in my SSH server configuration (for example LoginGracetime 2m), but can’t figure out how. I set up the server the following way:

  services.openssh = {
    enable = true;
    openFirewall = true;
    allowSFTP = false;
    ports = [ 20200 ];
    settings = {
      PasswordAuthentication = false;
      KbdInteractiveAuthentication = false;
      PermitRootLogin = "no";
      X11Forwarding = false;
      AllowUsers = [ "${user}" ];

Can I just add LoginGracetime = "2m"; to the settings section? I’m not sure if that’s possible, because I couldn’t find the option on the options search.

I’m thankful for every hint, as I am pretty new to NixOS.

1 Like


Yes, you could try, you are very close




looks like the place to put your setting

just try it?

1 Like

That worked, thank you!
I added the line services.openssh.extraConfig = "LoginGracetime 2m";.