···1515- `--path` now supports flakerefs (`github:foo/bar`, `git+file:///...`,
1616 `https://.../main.tar.gz`, etc).
1717- `--flake` is now an alias for `--path`.
1818-- wire will now attempt to use SSH `ControlMaster` by default.
1918- A terminal bell will be output if a sudo / ssh prompt is ever printed.
20192120### Fixed
···11+---
22+comment: true
33+title: Use a non-root user
44+description: Deploy as any user with wire.
55+---
66+77+# {{ $frontmatter.title }}
88+99+{{ $frontmatter.description }}
1010+1111+## Deploying User Requirements
1212+1313+If your selected deployment user does not fit the following requirements, the
1414+deployment commands will likely fail with an error:
1515+1616+| | Password-based SSH | Non-interactive SSH Auth |
1717+| :--------------------------------- | -----------------: | -----------------------: |
1818+| In `wheel` (Sudo User) | ❌ Not Supported | ✅ Supported |
1919+| Not In `wheel` (Unprivileged user) | ❌ Not Supported | ❌ Not Supported |
2020+2121+- "In `wheel`" here meaning a sudoer, whether it be `root` or not.
2222+- "Non-interactive SSH Auth" here most likely meaning an SSH key, anything that
2323+ does not require keyboard input in the terminal.
2424+2525+## Changing the user
2626+2727+By default, the target is set to root:
2828+2929+```nix
3030+{
3131+ deployment.target.user = "root";
3232+}
3333+```
3434+3535+But it can be any user you want so long as it fits the requirements above.
3636+3737+```nix
3838+{
3939+ deployment.target.user = "root"; # [!code --]
4040+ deployment.target.user = "deploy-user"; # [!code ++]
4141+}
4242+```
4343+4444+After this change, wire will prompt you for sudo authentication, and tell you
4545+the exact command wire wants privileged.
4646+4747+```sh{6}
4848+$ wire apply keys --on media
4949+ INFO eval_hive: evaluating hive Flake("/path/to/hive")
5050+...
5151+ INFO media | step="Upload key @ NoFilter" progress="3/4"
5252+me@node:22 | Authenticate for "sudo /nix/store/.../bin/key_agent":
5353+[sudo] password for deploy-user:
5454+```
···3535 };
3636 user = lib.mkOption {
3737 type = types.str;
3838- description = "User to use for ssh.";
3838+ description = "User to use for SSH. The user must be atleast `wheel` and must use an SSH key or similar
3939+ non-interactive login method. More information can be found at https://wire.althaea.zone/guides/non-root-user";
3940 default = "root";
4041 };
4142 port = lib.mkOption {