Last active
March 12, 2019 09:29
-
-
Save andromedarabbit/812331fd243ce0f833ea87e38505d0e9 to your computer and use it in GitHub Desktop.
Add external IP address of my Mac/Linux to the inbound rules of my DigitalOcean server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Prerequisites: `doctl`, `curl` and `jq` | |
# See https://www.digitalocean.com/community/tutorials/how-to-use-doctl-the-official-digitalocean-command-line-client | |
# In this particular case, we are going to open the port 22 for ssh connection. | |
MY_IP=$(curl --silent ifconfig.io/ip) && doctl compute firewall add-rules $(doctl compute firewall list --output=json | jq -r '.[].id') --inbound-rules "protocol:tcp,ports:22,address:${MY_IP}/32" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment