Just to understand matter a little better: As far is I've learned, common shells like fish or zsh only look in local directories for configuration files (like ~/.config/fish/config.fish or ~/.zshrc) but wouldn't this be extremly uncomfortable to lose all custumizations when running sudo su? Or is it generally depreciated to use su and one should try to get everywhere using sudo only? Vim, for example, also looks in /etc for a global vimrc.
Thanks for some clarification!
Last edited by ysetdng (2014-07-12 22:47:06)
I don't use su at all. If I want to be root, I'll be root.
As for vim, you shouldn't `sudo vim`, but use `sudoedit` with your VISUAL set correctly, which will enable you to edit files as your normal user and only become root when saving the file.
Last edited by lolilolicon (2014-07-12 16:51:55)
This silver ladybug at line 28...
wouldn't this be extremly uncomfortable to lose all custumizations when running sudo su?
You don't really run "sudo su." No way. I refuse to believe that.
As for retaining environment variables, that's what 'sudo -s' is for.
Personally I symlink some of roots config files to the ones in my users home, that way all of my bash functions and aliases stay synced between users. There's an if statement in my .bashrc to give root a different coloured prompt as well.
(I never knew about sudo -s, I've always used sudo -i)
Are you sure they only look in local config files? There's a file called "/etc/zsh/zprofile" which sources "/etc/profile". Anyway, I use "sudo -E" .
6EA3 F3F3 B908 2632 A9CB E931 D53A 0445 B47A 0DAB
Great things come in tar.xz packages.
Thanks a lot for the inputs! Now I've got some context.
Are you sure they only look in local config files?
I'm unsure now, the man pages say that zsh indeed also parses /etc/zshrc, I only checked the Arch Wike page before and there it doesn't mention this.
Last edited by ysetdng (2014-07-12 22:46:36)
By far the simplest approach for me is just to source my user's config files in /root/ config files. This wouldn't make sense on a truly multi-user system (unless of course only one user was really the system administrator who would use root).