SSH public key authentication: Difference between revisions

Phobos (talk | contribs)
m Minor edit for consistency in commands (fix to earlier edit)
m Make keyFiles suggestion compatible with pure evaluation mode
Tags: Mobile edit Mobile web edit Visual edit
 
(One intermediate revision by one other user not shown)
Line 62: Line 62:
== SSH server configuration ==
== SSH server configuration ==


You can manage SSH authorized public keys declaratively by adding them to your system to your system configuration:
You can manage SSH authorized public keys declaratively by adding them to your system configuration:


{{file|/etc/nixos/configuration.nix|nix|
{{file|/etc/nixos/configuration.nix|nix|
Line 76: Line 76:
Alternatively, you can reference a custom file containing the authorized keys:
Alternatively, you can reference a custom file containing the authorized keys:


{{file|/etc/nixos/configuration.nix|nix|
{{file|||
<nowiki>
<nowiki>
   users.users."user".openssh.authorizedKeys.keyFiles = [
   users.users."user".openssh.authorizedKeys.keyFiles = [
     /etc/nixos/ssh/authorized_keys
     ./ssh/authorized_keys
   ];
   ];
</nowiki>
</nowiki>
}}
|name=/etc/nixos/configuration.nix|lang=nix}}


For additional configuration options, see the {{nixos:option|users.users.*.openssh}} module documentation.
For additional configuration options, see the {{nixos:option|users.users.*.openssh}} module documentation.