Backing Up Time Machine to a Network-Attached Storage Device

If you’ve ever tried using Time Machine with a NAS pre-APFS days you’ll know the experience left a lot to be desired. I was encouraged by a colleague to give this another shot and am happy to report a huge improvement in speed and performance.

The initial backup of my machine, which was roughly 80GB of data took about 70 minutes to complete. I am also happy to report that Time Machine remembers the location of the NAS and will auto-mount it as needed.

If you’re using an UnRAID NAS, you will find this guide helpful:

https://wiki.unraid.net/UnRAID_6/Configuring_Apple_Time_Machine

Missing Sudo

If you have the pleasure of binding your macOS fleet to Active Directory some of you may have noticed issues using the sudo command for administrative users.

Chatter on the MacAdmins slack channel suggests that Apple has acknowledged the issue and will resolve it in a future update. Here’s how we’re temporarily working around this:

#!/bin/bash

# Collects the logged in user
loggedInUser="$(stat -f%Su /dev/console)"

# Checks to ensure logged in user isn't already in sudoers
if grep -Rq "$loggedInUser" /etc/sudoers
then
    echo "User ID already exists in sudoers file...Exiting"
else
    echo "$loggedInUser        ALL = (ALL) ALL" >>  /etc/sudoers
fi

Short and sweet. Run as root.