You are not logged in.

#1 2014-07-12 16:37:14

ysetdng
Member
Registered: 2014-05-02
Posts: 42

[SOLVED] Only local config files for common shells?

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)

Offline

#2 2014-07-12 16:51:23

lolilolicon
Member
Registered: 2009-03-05
Posts: 1,716

Re: [SOLVED] Only local config files for common shells?

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

Offline

#3 2014-07-12 16:59:46

ANOKNUSA
Member
Registered: 2010-10-22
Posts: 2,141

Re: [SOLVED] Only local config files for common shells?

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.

Offline

#4 2014-07-12 19:31:51

slithery
Member
Registered: 2013-12-01
Posts: 867

Re: [SOLVED] Only local config files for common shells?

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)

Offline

#5 2014-07-12 19:48:14

ConnorBehan
Trusted User (TU)
From: Long Island NY
Registered: 2007-07-05
Posts: 1,357
Website

Re: [SOLVED] Only local config files for common shells?

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" smile.


6EA3 F3F3 B908 2632 A9CB E931 D53A 0445 B47A 0DAB
Great things come in tar.xz packages.

Offline

#6 2014-07-12 22:46:08

ysetdng
Member
Registered: 2014-05-02
Posts: 42

Re: [SOLVED] Only local config files for common shells?

Thanks a lot for the inputs!  Now I've got some context.

ConnorBehan wrote:

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)

Offline

#7 2014-07-13 00:30:36

Trilby
Forum Moderator
From: Massachusetts, USA
Registered: 2011-11-29
Posts: 14,787
Website

Re: [SOLVED] Only local config files for common shells?

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).


InterrobangSlider
• How's my coding? See this page.
• How's my moderating? Feel free to email any concerns, complaints, or objections.

Offline

Board footer

Powered by FluxBB