Command line tool to create an entry in your ~/.ssh/config for each of your DigitalOcean droplets in Go
-
Create a Personal Access Token (PAT) in your DigitalOcean account. It's recommended to give it only read-only access.
-
Download a binary for your system from the Releases page, then extract and run:
./do2sshconfig [PAT] >> ~/.ssh/config
or better yet, install Go and then you can clone and run it:
git clone https://github.com/pengux/do2sshconfig.git
cd do2sshconfig
go build
./do2sshconfig [PAT] >> ~/.ssh.config
If you want to update the entries with new ones, make a backup first and then you can remove the old entries with this command:
sed '/# --- DigitalOcean hosts - Start ---/,/# --- DigitalOcean hosts - End ---/d' ~/.ssh/config > /tmp/ssh_config && mv /tmp/ssh_config ~/.ssh/config
./do2sshconfig -h
Usage of ./do2sshconfig:
-idFile string
Path of private SSH key to use
-ipv6
Use IPv6 instead of IPv4 as hostnames where possible
-user string
Use a different user instead of 'root' (default "root")