Skip to content

[UX] Improve untrusted user warning message#15369

Open
lisanna-dettwyler wants to merge 1 commit intoNixOS:masterfrom
lisanna-dettwyler:better-untrusted-user-message
Open

[UX] Improve untrusted user warning message#15369
lisanna-dettwyler wants to merge 1 commit intoNixOS:masterfrom
lisanna-dettwyler:better-untrusted-user-message

Conversation

@lisanna-dettwyler
Copy link
Contributor

Based on user feedback mentioned in the linked issue, more information about how to resolve an untrusted user issue should be provided in the warning message.

Resolves #8248

Motivation

This resolves a popular UX issue.

Context

#8248


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@lisanna-dettwyler
Copy link
Contributor Author

[untrusted@scarab:~]$ nix build nixpkgs#hello --option extra-substituters https://cachix.nixos.org/
warning: ignoring untrusted substituter 'https://cachix.nixos.org/', you are not a trusted user.
Add your username to the trusted-users setting in /etc/nix/nix.conf and then restart the daemon
(e.g. sudo systemctl restart nix-daemon).
Run `man nix.conf` for more information on the `substituters` configuration option.

Comment on lines +362 to +363
constexpr auto UNTRUSTED_MSG = "Add your username to the " ANSI_BOLD "trusted-users" ANSI_NORMAL
" setting in /etc/nix/nix.conf and then restart the daemon\n"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to have this link to a docs page about trusted users. There are caveats here: like the trust model, reasons to not do this, etc. that deserve to be presented. If the tool presents the simple instruction to follow, it could achieve it better by dropping untrusted users altogether (which would be a mistake.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to do this, and added a note to trusted-users about alternatives.

@lisanna-dettwyler
Copy link
Contributor Author

Is it OK to recommend that someone trying to use a privileged setting to make themselves a trusted user? Or should the warning message more specifically recommend that they add the privileged setting itself to /etc/nix/nix.conf instead of editing trusted-users?

@xokdvium
Copy link
Contributor

xokdvium commented Mar 1, 2026

This should really be up to the user, especially because being in trusted-users is equivalent to passwordless sudo.

@xokdvium
Copy link
Contributor

xokdvium commented Mar 1, 2026

If anything, even less users should be specifying trusted-users. I think there's a clear lack of understanding what that option even does - thus people are tempted to add themselves to trusted-users just to make the warning go away. We must not worsen the situation here.

@lisanna-dettwyler lisanna-dettwyler force-pushed the better-untrusted-user-message branch from 90470c7 to 43cc989 Compare March 1, 2026 21:02
@github-actions github-actions bot added the new-cli Relating to the "nix" command label Mar 1, 2026
@lisanna-dettwyler lisanna-dettwyler force-pushed the better-untrusted-user-message branch from 43cc989 to 6a51d4d Compare March 1, 2026 21:03
@lisanna-dettwyler
Copy link
Contributor Author

[untrusted@scarab:~]$ nix build nixpkgs#hello --option extra-substituters https://cachix.nixos.org/
warning: ignoring untrusted substituter 'https://cachix.nixos.org/', you are not a trusted user.
Run `man nix.conf` for more information on the 'substituters' and 'trusted-users' configuration options.
warning: ignoring untrusted substituter 'https://cachix.nixos.org/', you are not a trusted user.
Run `man nix.conf` for more information on the 'substituters' and 'trusted-users' configuration options.

[untrusted@scarab:~]$ nix build nixpkgs#hello --option trusted-public-keys ""
warning: ignoring the client-specified setting 'trusted-public-keys', because it is a restricted setting and you are not a trusted user.
Run `man nix.conf` for more information on the 'trusted-public-keys' and 'trusted-users' configuration options.
warning: ignoring the client-specified setting 'trusted-public-keys', because it is a restricted setting and you are not a trusted user.
Run `man nix.conf` for more information on the 'trusted-public-keys' and 'trusted-users' configuration options.

For some reason the warning message gets printed twice... not sure what's going on there.

@lisanna-dettwyler lisanna-dettwyler force-pushed the better-untrusted-user-message branch from 6a51d4d to 80168d9 Compare March 1, 2026 21:10
Direct users to the correct section in the nix.conf man page to read
about trusted users, as well as any privileged setting they are trying
to set. Also improve the documentation for trusted-users regarding where
it can be set, when it will be ignored, and alternatives to updating it.

Resolves NixOS#8248

Signed-off-by: Lisanna Dettwyler <lisanna.dettwyler@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-cli Relating to the "nix" command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[UX] Better info for untrusted users

3 participants