How to use a custom .bashrc file on SSH login

Posted by gsingh2011 on Server Fault See other posts from Server Fault or by gsingh2011
Published on 2012-06-20T13:01:43Z Indexed on 2012/06/21 3:18 UTC
Read the original article Hit count: 591

Filed under:
|
|
|

I've found that with the new company I'm working with I often have to access linux servers with relatively short lifetimes. On each of these servers I have an account, but whenever a new one is created, I have to go through the hassle of transferring over my .bashrc. It's possible however that in about a months time that server won't be around anymore. I also have to access many other servers for short periods of times (minutes) where it's just not worth it to transfer over my .bashrc but since I'm working on a lot of servers, this adds up to a lot of wasted time.

I don't want to change anything on the servers, but I was wondering if there was a way to have a "per-connection" .bashrc, so whenever I would SSH to a server my settings would be used for that session.

If this is possible, it would be nice if I could do the same thing with other configuration files, like gitconfig files.

© Server Fault or respective owner

Related posts about ssh

Related posts about bash