User management: Difference between revisions
Create user management page |
m Use nixos:options to be able to render <name> |
||
Line 11: | Line 11: | ||
User passwords can be defined declaratively by specifying a hashed password in the system configuration. To generate a password hash, run the following command and enter the desired password when prompted: <code>mkpasswd</code> | User passwords can be defined declaratively by specifying a hashed password in the system configuration. To generate a password hash, run the following command and enter the desired password when prompted: <code>mkpasswd</code> | ||
The resulting hash can then be assigned | The resulting hash can then be assigned to {{nixos:option|users.users.*.*hashedPassword|hashedPassword, initialHashedPassword, or hashedPasswordFile}} options within the user definition. Example: | ||
{{file|/etc/nixos/configuration.nix|nix| | {{file|/etc/nixos/configuration.nix|nix| | ||
Line 24: | Line 24: | ||
== User Home Directories == | == User Home Directories == | ||
By default, user home directories are created at <code>/home/<username></code> when {{nixos:option|users.users.*.isNormalUser}} is true. | By default, user home directories are created at <code>/home/<username></code> when {{nixos:option|users.users.*.isNormalUser|users.users.<name>.isNormalUser}} is true. | ||
Custom home directories can be set via the <code>home</code> option: | Custom home directories can be set via the <code>home</code> option: | ||
Line 33: | Line 33: | ||
{{main|Command Shell}} | {{main|Command Shell}} | ||
Login shells can be customized by setting the {{nixos:option|users.users.*.shell}} option. | Login shells can be customized by setting the {{nixos:option|users.users.*.shell|users.users.<name>.shell}} option. | ||
== User SSH Authorized Keys == | == User SSH Authorized Keys == | ||
Line 39: | Line 39: | ||
{{main|SSH public key authentication#SSH server configuration}} | {{main|SSH public key authentication#SSH server configuration}} | ||
SSH authentication can be customized by setting the {{nixos:option|users.users.*.openssh.authorizedKeys}} option. | SSH authentication can be customized by setting the {{nixos:option|users.users.*.openssh.authorizedKeys|users.users.<name>.openssh.authorizedKeys}} option. | ||
== Home Manager == | == Home Manager == | ||
For additional user environment configuration, including management of dotfiles, shell settings, and user-specific packages, consider using [[Home Manager]]. | For additional user environment configuration, including management of dotfiles, shell settings, and user-specific packages, consider using [[Home Manager]]. |