Auto-correct at the linux terminal

I came across this nugget some time back, which is helpful for people like me who type faster than their small brains can keep up with.

The long and short of it is, there’s a shell option that you can enable that automatically does some magic behind the scenes so that this can happen:

Just drop the below into your bashrc or run it in a live terminal to try it out. 

shopt -s cdspell

Me likey.

dynamic dns with google domains using ddclient on debian

Note: there’s a newer post covering this topic that involves containerization

After putting it off for ages due a perceived PITA process, I finally decided to check out how to set up dynamic dns to point at one of my servers that’s behind a changing IP. I was pleased at how surprisingly easy it is.

prereqs

I’m running debian 8 in a kvm vm, using bridged networking to give my web server it’s own identity.
The only package required is ddclient

configure google domains

Jump to the synthetic records section under your google domain dns settings and add the subdomain you want to forward to your dynamic host:

if you click on that blue “view credentials” link you’ll see the username and password google has randomly generated for you. you’ll need those details when you edit your ddclient.conf. note that until I’ve set up the config, the “data” section here shows 0.0.0.0 as my IP.

configure ddclient

for my setup, I’ve got several subdomains I want to forward to the same host. After checking out the ddclient manual, I’ve edited my ddclient.conf similar to the below:

protocol=dyndns2
use=web
server=domains.google.com
ssl=yes
protocol=dyndns2, login=host1login, password='host1password'
custom-subdomain.your-host1.com

test the ddclient configuration

the best way to test your configuration is by running the following command:
ddclient -daemon=0 -noquiet -verbose -debug
this will iterate all of your configured values and the give you pretty detailed debug output 

In the above, my subd.your-host1.com was a new host I added to the config, whereas subd.your-host2.com is one which I’d already updated during a prior test.

verify google has your ip

The final step to make sure everything looks good here is to refresh your google domains dns settings page. what you should see, as I do, is the data section now reflecting the ip for your dynamic host.

I also verified my /etc/default/ddclient config to make sure it’s got run_daemon set to true. When I installed ddclient via aptitude this was done automatically but you may want to double check yours if you find your client doesn’t update regularly. my default config looks like this:


# Configuration for ddclient scripts
# generated from debconf on Sun Feb 21 12:51:42 EST 2016
#
# /etc/default/ddclient
run_dhclient=”false”
run_daemon=”true”
daemon_interval="300"