Cloud Shell Profiles centralizes your shell profiles and SSH configuration using a cloud sync provider (Dropbox, OneDrive, Google Drive, Copy, etc) so that they are shared and synchronized between your machines.
The scripts are intended to be used cross-platform and support Linux, macOS and Windows (bash via WSL/MinGW/MSYS/Cygwin), although support for other OSs can be added in easily.
I regularly use Windows, macOS and Linux machines and wanted a simple way to keep my shell tooling in sync.
For security reasons, SSH password authentication is disabled on many of the machines I use and I quickly became annoyed at having to maintain all of my keys for personal and work use between several machines.
These scripts avoid all of that by keeping your configuration & keys in one place, new machine setup very easy and any changes to keys or configurations are transferred to all your other machines seamlessly.
- Clone this repo into your cloud provider's sync folder (e.g. in
~/Dropbox
) - On each of the machines you'd like to keep in sync:
- Install the desktop sync client of your chosen cloud provider
- Copy the contents of local-sample.profile to your
~/.profile
file (create it if necessary) - Adjust the
CLOUD_SHELL_PROFILES
variable as necessary to point to thecloud-shell-profiles
folder you checked out in step 1
- Open a new terminal session and type
echo $CLOUD_SHELL_PROFILES
- if all is working, you should see the path configured in step 2-iii!
Once you've laid the framework for cloud shell profiles, the rest is up to you.
Anything placed in common.profile will be sourced on all OSs, where as osx.profile, linux.profile and windows.profile are only sourced when starting a shell on that OS.
I've left a few handy aliases in those files, but feel free to clean those up if you don't want them.
Check out ssh/config.sample for some examples of cool tricks you can do with a SSH config.
If you have SSH keys, place them in the ssh folder of your cloud shell profiles folder so that they are synchronized between machines (make sure they are password-protected).
Changing your .ssh
directory to a symbolic link is the easiest way to ensure
your SSH configuration and keys are used consistently between machines:
mv ~/.ssh ~/.ssh.bak
ln -s "$CLOUD_SHELL_PROFILES/ssh" ~/.ssh
# This prevent SSH from backing out due to bad permissions after a cloud sync
chmod 700 "$CLOUD_SHELL_PROFILES"/ssh ~/.ssh
chmod 600 "$CLOUD_SHELL_PROFILES"/ssh/*
chmod 644 "$CLOUD_SHELL_PROFILES"/ssh/id_*.pub
Now simply use relative paths (i.e. IdentityFile id_rsa_foo
) in your SSH
config as usual.
If some of your machines fail when using the symlink approach above, you can
still alias ssh
as ssh -F path-to-cloud-shell-config
to force it to use
the cloud synchronized SSH config, but you will need to specify keys to SSH
using one of two approaches:
- Provide the absolute path to the key each time IdentityFile is used (i.e.
IdentityFile ~/Dropbox/cloud-shell-profiles/ssh/id_rsa_foo
), requiring you install cloud-shell-profiles at the exact same location on all machines. - Provide a relative path (i.e.
IdentityFile id_rsa_foo
) and copy the keys from$CLOUD_SHELL_PROFILES/ssh
to~/.ssh
manually. You will be required to manually re-copy them every time you add/change a key, but this permits your cloud shell profiles folder to live in different places on different machines.
autoloader.profile
is responsible for loading OS-specific profiles. If your OS
is not recognized (e.g. if you use a BSD variant), unmatched.profile
is loaded
by default with a small warning. Adjust autoloader.profile
if you want to load
a new OS-specific profile.