Syncing SSH config

December 18th, 2011 by Eoin eTeanga Leave a reply »

You can set up SSH to connect without requiring a password each time.

SSH config

It’s handy to configure SSH connections.

For example, you can keep all SSH connections alive by default.

Edit ~/.ssh/config and add the following command:

    Host *
        ServerAliveInterval 240

Sync the config between your computers

But you still have to set that config file on your different computers.

Enter Dropbox. Store the config file in Dropbox, and point a symbolic link to it so that SSH on your computer will use that configuration.

  1. Create a folder under Dropbox, named .ssh for example.
  2. Copy ~/.ssh/config to ~/Dropbox/.ssh/
  3. Rename ~/.ssh/config to ~/.ssh/backup.config
  4. Make a symbolic link so that your Dropbox config will be found by your SSH:
    `ln -s ~/Dropbox/.ssh/config ~./ssh/config`

Summary

Now you can edit SSH’s config in Dropbox, and it will update on the rest of your machines.

But is there a more intelligent way of doing this?

Advertisement
  • http://ahmetalpbalkan.com ahmet alp

    I’m not clear what is it for. In the .ssh/config file, I only store things like

    Host ol
    Hostname 178.79.139.55
    User root
    IdentityFile /Users/alp/.ssh/id_dsa.pub

    and see no point to sync this everywhere. P.S. Install a “subscribe to comments” plugin to your wordpress.

    • http://www.eteanga.ie Eoin eTeanga

      Yes, I store host, hostname, user, and port in that file.

      The reason to sync it is to share that information across computers – I have quite a few VPS user accounts. The list changes sometimes, and it’s nice to have it synchronised (for example, when I create a new VPS account).

      What do you think in that case?

      Thanks for the tip on the subscription plugin.

  • http://ahmetalpbalkan.com ahmet alp

    so do you install Dropbox on command-line only VPS machines?

    • http://www.eteanga.ie Eoin eTeanga

      No, I don’t. I only have Dropbox on the machines I use to connect **to** my VPS accounts. I have Dropbox on my laptop, for example.

  • Ahmet Alp

    Better you use got for your configs, I think.

  • Ahmet Alp

    Sorry a typo due to autocorrect. I tried to mean “git”.

  • http://www.eteanga.ie Eoin eTeanga

    Would you have a private repo which collects your configs in one place? One repo to collect configs for all programs?

  • wade222