sshrc – make your ssh sessions feel like home
github.com
github.com
python2 -m SimpleHTTPServer 12345
Then you can just use something like the following function to get a remote session: sshrc() {
ssh -R 12345:127.0.0.1:12345 -t ${*:1} 'bash -c "bash --rcfile <(curl -s http://127.0.0.1:12345/sshrc)"'
}
This has some nice side effects in that you can then just host your vimrc the same way. I think you can get vim to load plugins from a http runtime path too, but I have never looked into it.Doing it this way has its own quirks though.
This function allows you to push out local functions, variables, and arrays to a remote system. There is an updated version in the client script for my backup utility (snebu), which also includes getting remote variables returned to the local shell script, and also bouncing through sudo.
Should I move this to a regular project on Github, or keep it in the gist?
Very nice - clean and simple.
I feel as though we should have had first-class support for portable environments all along, and it shocks me that we haven't considered building this kind of facility before. This could be a game changer. Like vim package managers and other sensibly modern things, I totally expect to see this evolve to become the new norm.
I see this kind of configuration:
* global personal configs (lightweight, truly global settings for work and home)
* local overrides (work, home, per machine, non-SSH)
* remote overrides (SSH machines)
Global configs should be portable everywhere. For everything else, I see a system capable of merging several such configs and matching the current environmental and capability context.
Thanks!
I like the idea of this in theory if you have machines that are frequently touched/overwritten, though, if you just want to have a baseline of sanity on them automatically when you log in.
Pretty simple stuff to set up, but allows for some pretty powerful configuration
. clarkm.env
That way you can each effectively have your own .bashrc. You could also have the following in your clarkm.env: unlink .emacs
ln -s .emacs.clarkm .emacs
Or, if emacs supports it, alias in whatever command line flag that emacs uses to read from a different config file. Eg alias emacs="emacs --config .emacs.clarkm
I don't use emacs personally so the above will be inaccurate, but that kind of thing might work for you.[1] https://www.digitalocean.com/community/tutorials/how-to-use-...
In the exact use case here, I would likely just store a bash script named .bash_ansible or similar on the target server and just source that manually at login, but the sshrc system looks like an easier way to maintain a config without leaving a footprint.
If people regularly send large directories, you might also want to extend this with rsync.
Something like this:
# .sshrc
source ~/.bashrc
source ~/.alias