If you do not want to install the desktop update client, you can update your hostname with a small Bash script and a cron job on macOS or Ubuntu.

This guide uses the CheckIP Tool to detect your public IP address and the Dynamic DNS Update API to send the update.

Quick summary

  • Open Terminal
  • Get your Dyn update client key from your profile page
  • Download the script, move it into ~/Dyn, and update it with your hostname and Dyn username
  • Run the script once so it can create the key file for you
  • Paste your key into that file, then run the script again to confirm it works
  • Schedule the script to run every 10 minutes

File locations

  • Script: ~/Dyn/update-dyndns.sh
  • Key: ~/.config/dyn/ddns-key
  • Log: ~/.config/dyn/ddns-update.log

Before you begin

Make sure you have:

  1. A Dyn account
  2. A Dynamic DNS hostname or Standard DNS hostname that accepts dynamic updates
  3. Your Dyn username
  4. Your update client key

The update API can use either your account password or an update client key. This guide uses and strongly recommends the update client key because it can update your hostname but cannot be used to sign in to your Dyn account.

You can view or generate your update client key on your profile page at https://account.dyn.com/profile/:

  • If you do not already have a key, click Generate Key
  • If you already have a key, click Show Key

Use HTTPS for the update request. Do not paste secrets into one-off shell commands that will be written to your shell history.

Security recommendations

Store your update client key in a file with chmod 600.

Recommended file location:

  • ~/.config/dyn/ddns-key

Only the account that runs the cron job should be able to read this file.

Required tools

This script expects these commands to be available:

  • bash
  • curl
  • sed
  • head
  • tr
  • date
  • install
  • crontab

On Ubuntu, install curl if it is missing:

sudo apt update
sudo apt install curl

On macOS, curl is usually already installed.

Download and prepare the Bash script

  1. Download update-dyndns.sh into your Downloads folder.
  2. Open Terminal.
  3. Create ~/Dyn if it does not already exist:
mkdir -p "$HOME/Dyn"
  1. Move the script from Downloads into ~/Dyn:
mv "$HOME/Downloads/update-dyndns.sh" "$HOME/Dyn/update-dyndns.sh"
  1. Open the script in a text editor:
nano "$HOME/Dyn/update-dyndns.sh"
  1. Replace yourhost.example.com with your hostname and your-dyn-username with your Dyn username, then save the file.
  2. Make the script executable:
chmod 700 "$HOME/Dyn/update-dyndns.sh"

Run the script and add your key

Expected first-run behavior: the script creates ~/.config/dyn/ddns-key and then exits. This is normal.

Run the script from Terminal with this command:

bash "$HOME/Dyn/update-dyndns.sh"

On the first run, if the key file does not exist yet, the script creates ~/.config/dyn/ddns-key and stops. Protect that file with restricted permissions:

chmod 600 "$HOME/.config/dyn/ddns-key"

Open the key file in an editor:

nano "$HOME/.config/dyn/ddns-key"

Paste your update client key into the file, save it, then run the script again:

bash "$HOME/Dyn/update-dyndns.sh"

Test the script before scheduling

After you save your update client key and run the script again, inspect the log file:

tail -n 20 "$HOME/.config/dyn/ddns-update.log"

Common successful responses include good and nochg. If you receive an error response, review the Return Codes page.

Expected results

  • On the first run, if the key file does not exist yet, the script creates ~/.config/dyn/ddns-key and stops.
  • After you add your update client key and run the script again, a successful result is usually good or nochg.

Add the cron job

Edit your crontab:

crontab -e

Use a full path in the cron entry.

On Ubuntu, add this line to run every 10 minutes:

*/10 * * * * /bin/bash /home/youruser/Dyn/update-dyndns.sh

On macOS, the full path usually looks like this:

*/10 * * * * /bin/bash /Users/youruser/Dyn/update-dyndns.sh

Some cron environments may also expand $HOME:

*/10 * * * * /bin/bash "$HOME/Dyn/update-dyndns.sh"

Do not schedule the job more often than every 10 minutes. Dyn guidance for CheckIP and update activity is to space checks apart to reduce load.

Verify that cron is working

Use these checks after saving the crontab:

  1. Run the script once manually
  2. Review ~/.config/dyn/ddns-update.log
  3. Confirm the cron entry is installed with crontab -l
  4. In your Dyn account, confirm the hostname shows the expected IP address and latest update time

If your IP address has not changed, nochg is a normal result.

Troubleshooting

The script does not run from cron

  • Use full paths in the script and in the crontab entry
  • Make sure the script is executable
  • Confirm the cron service is available on your system

The script cannot detect my public IP

  • Confirm the system can reach http://checkip.dyndns.org/
  • If CheckIP fails, do not send an update request
  • Make sure your sed expression still matches the returned page

I receive authentication or abuse responses

  • Confirm the username and update client key are correct
  • Make sure only one updater is managing the hostname
  • Do not schedule checks more frequently than every 10 minutes

Remove the cron job

If you no longer want to use this method:

  1. Run crontab -e
  2. Delete the Dyn update line
  3. Save and exit
  4. Remove ~/Dyn/update-dyndns.sh, the key file, and the log file if you no longer need them

Related resources