Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What would be the best way to get the same shell environment (paths excluded) on all my accounts automatically?

What I want is something that transfers the aliases, coloring, and other cool shiznit I have going on in my shell to other shells when I login. Is this possible? Do I have to copy my .bashrc file to all my accounts?

share|improve this question

Make any changes you need to make to /etc/skel. When you invoke useradd, it'll copy the content of this folder into the user's home directory, automatically.

share|improve this answer
I'm talking about existing accounts. I know I can manually copy over bashrc or what ever the shell is. I just want the login to do this for me. – d-_-b Nov 17 '10 at 16:46
Ah, then Gopoi's answer will do you. Rather than copy the files into place on existing accounts, simply add the configuration to /etc/bashrc (this might have a different name on some distros, such as /etc/bash.bashrc on Debian). This file is executed before the users own, so you don't need to have it copied into place. Or do you specifically want to enforce a standard bashrc and prevent local changes? – SmallClanger Nov 17 '10 at 20:43
I think I want all my account's /home/user/.bashrc to be in sync with my laptop without extra effort to set up something on the server. Is there a way to push a file to the server before bash runs? – d-_-b Nov 18 '10 at 2:40
So you have a primary user account on a laptop, and you want to copy the .bashrc from it to another system, where it will become the default for all users? – SmallClanger Nov 19 '10 at 14:06
No, just my account of course. I want to be able to use all my nifty aliases etc. – d-_-b Feb 6 '11 at 5:34

If you run bash yo can edit /etc/profile and /etc/bashrc. They are analog to the user ~/.profile and ~/.bashrc.

So put all your common vars in /etc and user more specifc in ~/.

share|improve this answer
and how do I have that transfered to the target when I log in? – d-_-b Nov 17 '10 at 16:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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