Spyke
nix·Nix / NixOSbyClot

Sudo doesnt retain settings of ~/.config

Whenever I run any command line tools without sudo, they take the settings as in ~/.config and work fine. But whenever I run the same CLI tools with same parameters but with sudo, it falls back to default setting. How can I make this behavior consistent?

View original on lemm.ee
Clotreply
lemm.ee

Thanks for the heads up! I will try the given solutions.

but that doesn't do anything with ~/.config

What do you exactly mean by this?

1

The letter ~ (tilde) is relative to the current user. When you use sudo, you become root. So ~ points to /root. Whereas if you are not using sudo then ~ points to /home/yourname

2

I run commands as the root user so I use the root users configs. Usually that's in /root/.config/ but it might be different in NixOS.

You'll have to either copy your configs over to the root users config dirs. I highly recommend auditing what you copy though for security.

5

You reached the end

Sudo doesnt retain settings of ~/.config | Spyke