LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-17-2012, 04:58 PM   #1
ForumUser2
LQ Newbie
 
Registered: Aug 2012
Posts: 2

Rep: Reputation: Disabled
System wide .bashrc file - bad idea?


I am a bash user who would like to create multiple logins on a single Linux workstation where each login would have a distinct user environment for development.

I currently use the .bashrc file in each users home directory for most of my bash environment set-up. It occurred to me that I could create a 'system wide' .bashrc (for settings common to all users) in /usr/etc and then source it from the .bashrc in each home directory.

The fact that I've never seen this done before makes me wonder if there are some obvious downsides that I don't see.

Any advice?
 
Old 08-17-2012, 05:11 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,258

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
/etc/bashrc and /etc/profile are standard on most linux distros, you probably already have them. Often they will automatically source any .sh file in /etc/profile.d/ as well, which is where it's recommended you place global environment setup functions like the one you're planning.

Last edited by suicidaleggroll; 08-17-2012 at 05:13 PM.
 
1 members found this post helpful.
Old 08-17-2012, 06:36 PM   #3
devnull10
Member
 
Registered: Jan 2010
Location: Lancashire
Distribution: Slackware Stable
Posts: 548

Rep: Reputation: 116Reputation: 116
If you just sourced it in each users .bashrc, the user could just change that file if they wanted to exclude it (or delete and recreate it). So don't rely on it.
 
Old 08-17-2012, 11:00 PM   #4
ForumUser2
LQ Newbie
 
Registered: Aug 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
@suicidaleggroll: thanks for the pointer, got me going in the right direction.

On my system (Ubuntu 11.10) the /etc/profile.d only has a script dealing with 'bash_completion'. There is no /etc/bashrc, but there is a /etc/bash.bashrc file. Like ~.bashrc, the bash.bashrc is getting sourced implicitly during creation of sub-shells, but not login shells.

This would certainly work for my goal of having a single location for system wide bash environment settings. I can put the global settings in /etc/bash.bashrc and then source both ~.bashrc and /etc/bash.bashrc from the ~.profile files.

Last edited by ForumUser2; 08-17-2012 at 11:06 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
A system wide .exrc file. swamprat Linux - Software 1 04-26-2012 08:53 PM
Can I override system wide source by editing bashrc m2azer Linux - Newbie 1 10-29-2009 07:24 PM
Identifying unaccountable, BAD, system-wide latency? 2.6.25.9 & nVidia 173.14.09 GrapefruiTgirl Linux - General 11 07-04-2008 03:39 PM
Operating system on RAID - good idea or bad? BrianK Linux - General 4 05-07-2007 02:01 PM
Good idea/bad idea: interface colors introuble General 5 10-30-2006 02:33 PM


All times are GMT -5. The time now is 08:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration