Can sudo application use .config of the user?

I was wondering if it is possible to use all my configuration files even when starting some software with the sudo command.

For example when I lauch micro text editor.

micro somefile

It uses my /home/vlkon/.config/micro/ settings

But when I start

sudo micro somefile

It uses /root/.config/micro settings

Is this something that has to be configured “per application”?
Also is this kind of approach that I want to achieve a severe security risk?
If it is of any importance I use bash.

You could try using sudo -E

If that doesn’t work, it may be micro looking at who the user is and then grabbing that users config.

In the case of micro, it is probably safe to do something like:

sudo ln -s /home/vlkon/.config/micro /root/.config/micro

It could be depending on what application you are using with sudo. In the case of micro I don’t think this would be a major risk.

3 Likes

I will try that next time I mess with sudo. It’s not so often. Micro was just an example. I just didn’t know if there is a global setting for sudo or not. Exspecially something that would be preserved when I reinstall the system (/root directory isn’t).

1 Like