0

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 ?

  • 1
    You almost certainly shouldn't be running X, XFCE, terminal, etc... as root. For vim and a few others your question is perfectly valid, but once you reduce the scope of the question to software that you should be running as root, you may find that the problem of duplicated configurations is a lot less important than you feel that it is now. – Celada Mar 27 '16 at 19:39
0

From my point of view there are at least 3 ways to solve your question:

  1. Do not use root account in the first place. Really. Configure just vim for root separately and that's it. sudo is 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.

  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.

  3. 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?

0

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.

  • 1
    While this answer is good from broader POV, it doesn't answer the question. The user is clearly a beginner and this needs to be said, but we should tell how to do it anyway, imho. Once you understand what using root account means, you can start using it. I do and take precautions not to mess anything up, and it works. If I asked this question I'd expect answer, not just warning. – MatthewRock Mar 27 '16 at 22:23
  • root escalation exploits are so easy that some OSes like Qubes don't even bother with making root and user separate as they rely on other means to make the system secure, so I don't know why everybody seem to make such a big deal of it – ChiseledAbs Mar 27 '16 at 22:28
  • @ChiseledAbs because you're vulnerable in one way doesn't mean you should be in other. Moreover, it's not only the matter of security from exploits as it is from you; root can literally do everything, meaning that you can destroy your data unintentionally. There are lots of stories about beginners making dumb choices. Some of them were saved because of non-root accounts. That's why Gilles answer is good from broader POV. It brings some insight, although it doesn't explains why; I don't blame him though; these are the lessons you probably have to experience by yourself. – MatthewRock Mar 27 '16 at 22:57
  • @MatthewRock I do answer the question: sudo preserves the home directory, so when you do need to use the root account, you get the same configuration. – Gilles Mar 28 '16 at 15:28
  • @Gilles not the most direct way, but fair enough – MatthewRock Mar 28 '16 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.