Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

2 Answers

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 –  dcd018 Sep 23 '13 at 4:01
add comment

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
add comment

Your Answer

 
discard

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.