Using JumpCloud MDM: Network Volumes & Time Machine

Backup Issues

I recently ran into some problems with my current backup solution, so I decided to use Time Machine again. I also wanted to automate the process via MDM (Mobile Device Management). I am using JumpCloud as the primary MDM platform for most of my clients, but the commands I’m about to share with you should work on other platforms as well since they are just terminal commands. The first thing I did was check to see if I could define Time Machine settings by creating a custom MDM profile and deploying it as a policy in JumpCloud. There are a few different tools out there for creating custom MDM profiles, but none of them worked the way I wanted them to. I then chatted with JumpCloud Support, and also checked JumpCloud’s GitHub repository for commands and policies, but they didn’t have what I needed either. After going down a rabbit hole of research, I’ve pieced together a solution that may come in handy if you’re looking to automate backups via Time Machine.

Before you begin, make sure that your shared folder has the appropriate settings to work with Time Machine.

First you have to create a mount-point within a folder that the user has access to. Usually, mount-points reside in the systems/volumes folder, but the user won’t have write privileges to that folder, so you have to make a new one. I am using /mnt in this example, but you can use whatever you want. I also like to add an echo just so I can see the progress of the command as it runs.

#Create the Mount-Point

mkdir -p /Users/USERFOLDER/mnt

echo "Mount Point Created”

Don’t forget to replace all of the capitalized fields with your own, per user.

Next, we need to mount the network volume using the mount-point we just created. 

#Mount the Network Volume

mount_smbfs "//USERNAME:PASSWORD@HOSTNAME/SHARENAME" /Users/USERFOLDER/mnt

echo "SMB Share Mounted"

Hostname can be a Network Hostname, IP address, or FQDN, just remember to include the shared folder so you mount directly to it.

Now that the volume and shared folder are mounted, we can set the Time Machine destination.

#Set the Time Machine Destination

TimeMachineDestination="smb://USERNAME:PASSWORD@HOSTNAME/SHARENAME"

echo "Setting Time Machine Destination"

/usr/bin/tmutil setdestination $TimeMachineDestination

echo "Enabling Time Machine"

/usr/bin/tmutil enable

Finally, we can start the backup.

#Start Backup

tmutil startbackup

echo "Backup Started"

By Default, the first backup will check the “Backup Automatically” box so you’ll only have to start it once.

Well that’s it! You can run these commands separate if you want, or you run them all in one command like this:

mkdir -p /Users/USERFOLDER/mnt

echo "Mount pointed created"

mount_smbfs "//USERNAME:PASSWORD@HOSTNAME/SHARENAME" /Users/USERFOLDER/mnt

echo "SMB share mounted"

TimeMachineDestination="smb://USERNAME:PASSWORD@HOSTNAME/SHARENAME"

echo "Setting Time Machine Destination"

/usr/bin/tmutil setdestination $TimeMachineDestination

echo "Enabling Time Machine"

/usr/bin/tmutil enable

tmutil startbackup

echo "Backup Started"

exit 0

If you’re ever in need of MDM consulting, whether it be Apple Business Essentials, Jamf Pro, or JumpCloud, give us a shout and we’d be happy to assist you.

Until next time!

Next
Next

Is Your Home Network Secure?