I've got about 10 remote servers being managed, through SSH, and I typically just SSH into each of them for remote management tasks. This requires me to have duplicated many of my dotfiles (like .zshrc, .vimrc) across each server so that I have a uniform experience across each one. Therefore, making a change to one of these files means distributing it out to all servers (worst case, manually, and in the best case using a provisioning tool like Ansible).

But if I were to mount the root filesystems of all those servers on my local workstation (like at /mnt/servers/server1/, /mnt/servers/server2/, etc) using something like NFS, SSHFS, Samba, or something else, then would that eliminate the need to share and copy dotfiles across each of these servers?

Because I'm using my local shell and Vim so only my local .zshrc and .vimrc get used. If I need to edit /etc/hosts on server3 I do it from my local workstation 'vi /mnt/servers/server3/etc/hosts' to edit the hosts file.

Will this eliminate the need for synchronizing my dotfiles across all the servers I'm managing?

  • 1
    You might be interested in this: vim.wikia.com/wiki/Editing_remote_files_via_scp_in_vim Jan 14, 2014 at 21:42
  • If you need to restart services running on the remote server, you have to be on that server. Jan 14, 2014 at 21:43
  • 1
    Have you tried keeping the dotfiles on a single share and use symlinks on all the managed servers? After mounting that share on all the servers of course.
    – MDMoore313
    Jan 14, 2014 at 22:48

2 Answers 2


This is a bad practice on what you are trying to do. First, you shouldn't be ssh-ing as often to the servers so that you require your .vimrc and .zshrc on remote hosts. Production machines need to be logged on in emergency situation mostly and even then all the work is done with root.

Second, if you still need to do that you can accomplish it utilizing ssh client configuration file "~/.ssh/config".

Put this in your "~/.ssh/config" on the client you are constantly connecting from:

cat ~/.ssh/config

Host *
  PermitLocalCommand yes
  LocalCommand scp /home/my_username/.*rc my_username@%h:/home/my_username/

This will copy your ~/.*rc files to every server you ssh to. But again it is not secure and desirable solution to use.

  • I didn't dv, but what's wrong with some config files on a production server, if it allows you to work faster?
    – MDMoore313
    Jan 14, 2014 at 23:27
  • 1
    I think it is a bad practice. Servers are not meant to be of your convenience. Configured once, they never get touched, configuration management should do all the work. Jan 14, 2014 at 23:32

I keep my dotfiles in a git repository along with a script that manages symlinks to them. In my profile file (that is sourced on login) I run a git pull and that script.

You must log in to answer this question.

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