Hello I just installed Debian and have only one user since it's my personal computer. I would like for all softwares, x, xfce, terminal, vim, shell to always have the same configuration without me having to to manually configure everything twice once from user and once from root. Is there a convenient way to have the same configuration for both accounts ?
From my point of view there are at least 3 ways to solve your question:
Do not use root account in the first place. Really. Configure just vim for root separately and that's it.
sudois your best friend. As a bonus you have improved logging of all your root activities and the whole command history in a single place. Can be combined with option 2.
Put all your configuration into ansible or something similar. Configure it to be deployed into /root and your user home dir. If you have to change something, just change in the configuration project and deploy. It will be deployed to all directories at once. As a bonus you have all the configuration in a single place, which can be easily extended to as many users as you want. If you put it to git or other VCS you can have a nice history of changes. lso it can be easily transferred to a brand new machine. Can be combined with option 1. That will be the best solution I believe.
I don't like this solution to be honest, though it's very simple. So still worth to mention. Make a cron job to copy all configuration from /root/ to your user's home (overwrite files and directories if exist). Do not configure it vice versa, as it would be extremely bad for your security (even if you're the only user of machine). Who knows what your browser is able to download?
That's easy: don't log in as root. You don't need configuration files in the root account because you shouldn't be running programs as root. (And the fact that you shouldn't be doing this explains why there's no convenient method of doing it.)
There are a few administration programs that it makes sense to run sometimes as root and sometimes as a user, e.g. a package management program such as
aptitude. (This isn't necessary though: you can always launch aptitude directly and then use its “become root” command.) Just run these programs with
sudo; under the Debian configuration, this preserves the
HOME environment variable so e.g.
sudo aptitude will lead to aptitude looking for its configuration in your home directory.