Super User is a question and answer site for computer enthusiasts and power users. 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

I have a custom .bashrc file with color codes locally on my Linux machine running Ubuntu 12.04 for both my user and root. I connect to Amazon EC2 instances daily running the same distro and would like to somehow use the same .bashrc files for my user and root without having to manually create them since we'd like to keep the instances generic seeing as multiple developers ssh to them.

Is it possible to have an EC2 instance read from my local .bashrc file during a session so I can have the same color scheme as my local bash prompt?

share|improve this question
up vote 1 down vote accepted

Yes it is possible but really not worth the effort. Just copy the file over or create a new file on the EC machine and source it from your .bashrc there:

. $HOME/home_bashrc

You can then delete it whenever you want.

Anyway, one way of sourcing your actual home ~/.bashrc is to set up passwordless ssh from the EC server to your machine and then add this line to your EC ~/.bash_profile:

scp user@local:/home/user/.bashrc $HOME/home_bash && source $HOME/home_bash

Then, add this to your ~/.bash_logout:

rm $HOME/home_bash

That way, the file will be deleted as soon as you log out.

share|improve this answer
I like deleting it on logout.. Agreed, not worth the effort – dcd0181 Sep 23 '13 at 4:01

Completely untested: if, from the remote server, you can ssh back to your local machine, then you could do:

. <(ssh user@local 'cat .bashrc')

Or, you could copy your .bashrc to the remote server as .bashrc_dcd018 and source that.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .