sh 将我的Mac / Linux的外部IP地址添加到我的DigitalOcean服务器的入站规则中

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh 将我的Mac / Linux的外部IP地址添加到我的DigitalOcean服务器的入站规则中相关的知识,希望对你有一定的参考价值。

# 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"

以上是关于sh 将我的Mac / Linux的外部IP地址添加到我的DigitalOcean服务器的入站规则中的主要内容,如果未能解决你的问题,请参考以下文章