3

I have a few servers that I have personal accounts on, I have created an SVN repository to contain my home directory so that I can manage my dotfiles across these servers, which I'm finding works very well and makes it easy for me to track the changes I make (which previously would get lost/overwritten very easily).

The new problem I face is that at work I'm now forced to share one of two accounts (deploy/root) with a bunch of coworkers, and as a result I can't set too much in the way of global options.

Is there anything I can do to have the other end see my .vimrc in that session while I'm logged in (or some kludge and $VIMRC setting that makes vim load my local one?) vim is the main thing but it'd be nice to extend the principle to others as well.

richo
  • 938
  • 1
  • 7
  • 16
  • I think the real problem here is that you are sharing accounts. Whatever you need to do as root or deploy needs to be managed by something like radmin, puppet and friends. – Alex Holst Dec 14 '10 at 08:59
  • Thanks for your input Alex. I agree, I started at this company as SysAdmin a month ago. I am working towards fixing some of these issues (individual accounts) but in the meantime I'm stuck with what was left by my predeceessor. The deploys themselves are completely automated, but I often have to login to a production server to tweak/inspect/investigate. – richo Dec 14 '10 at 22:28
  • I really want a solution to this too. The best I found was this but I don't want to deal with installing special software: https://github.com/Russell91/sshrc (I had a bad experience with mosh) – Sridhar Sarnobat Jul 15 '17 at 01:06

2 Answers2

2

This is an old question but I thought I'd add my suggestions in case any one else has similar issues and they aren't in a position to come up with a better solution:

For Vim, a simplistic solution would be to run:

vim -u /my/personal/repos/dotfiles/.vimrc

But that will use the account's .vim / vimfiles directory structure. If the server is some form of *nix and you want to run a POSIX compliant shell with personalised environment variables, start a sub-shell with a different value for HOME, e.g. the following command will start a Bash login shell:

HOME=/my/personal/repos/dotfiles/ bash -l

The above will source /my/personal/repos/dotfiles/.profile or .bash_profile and any other processes spawned by the sub-shell will inherit its environment variables (including HOME).

Anthony Geoghegan
  • 2,800
  • 1
  • 23
  • 34
0

I think that https://github.com/fsquillace/kyrat does what you need.

I wrote it long time ago before sshrc was born and it has more benefits compared to sshrc:

  • It does not require dependencies on xxd for both hosts (which can be unavailable on remote host)
  • Kyrat uses a more efficient encoding algorithm
  • It is just ~20 lines of code (really easy to understand!)
  • No need of root access or any installations to the remote host

For instance:

$> echo "alias q=exit" > ~/.config/kyrat/bashrc
$> kyrat myuser@myserver.com
myserver.com $> q
exit
user967489
  • 111
  • 1
  • 3