How do you guys quickly sync your settings (especially bash aliases and ssh keys) across your machines?

Ideally i want a simple script to run on every new server I work with. Any suggestions?

  • S410@kbin.social
    link
    fedilink
    arrow-up
    9
    ·
    edit-2
    1 年前

    On my devices like PCs, laptops or phones, syncthing syncs all my .rc files, configs, keys, etc.

    For things like servers, routers, etc. I rely on OpenSSH’s ability to send over environmental variables to send my aliases and functions.
    On the remote I have
    [ -n "$SSH_CONNECTION" ] && eval "$(echo "$LC_RC" | { { base64 -d || openssl base64 -d; } | gzip -d; } 2>/dev/null)"
    in whatever is loaded when I connect (.bashrc, usually)
    On the local machine
    alias ssh="$([ -z "$SSH_CONNECTION" ] && echo 'LC_RC=$(gzip < ~/.rc | base64 -w 0)') ssh'

    That’s not the best way to do that by any means (it doesn’t work with dropbear, for example), but for cases like that I have other non-generic, one-off solutions.