Using Rsync to remotely backup Apple OSX User profiles
DustinB3403 last edited by scottalanmiller
The reasons for needing to use Rsync are pretty obvious, for my purposes the reasons are to make domain migrations a bit easier, specifically so I can backup the user profile with the user still using the laptop and only having to sync the changes they've made once I'm ready to do all of the heavy lifting (taking their device away).
In this example I'm using Rsync to backup to an external volume attached to my Apple Laptop. You can rsync to a local directory if you wanted.
First you'll need to enable the root account on your target computer as Apple has disabled the root account by default, read here on how to enable this.
You can now begin the Rsync process (I'm still playing with the options so take them with a grain of salt)
rsync -av -e ssh [email protected]:/Users/UserName/ /Volumes/VolumeName --progress
At this point the sync process will begin for the target user account and once completed you can go and grab the user workstation and only sync the delta.
You'll need root access on the user system to ensure you can copy the actual user profile (desktop, documents, downloads and literally everything else).
Without enabling the root account, you'll initially get "Permission denied" errors that you won't be able to work around without enabling root.
Of course, once the root account is enabled, you could setup ssh keys, and deploy those keys to each of your target workstations so you don't have to pass credentials.
black3dynamite last edited by black3dynamite
ssh -t [email protected] 'sudo rsync -av /Users/UserName/ /Volumes/VolumeName --progress'
No need to enable root, just use an account that has sudo rights.
@black3dynamite in my testing root access is required as the local admin account can't elevate to access the user files that are from the domain.
This is evidenced in looking at the users root folders and seeing things with the red stop symbol.
I will give that a try though and see what occurs.
So I just tested @black3dynamite and while it appears to work, it doesn't actually copy the files. It runs, but nothing is loaded into the destination.
Going back and testing again, but I need to keep forward progress on this project.
Worth noting that using rsync worked very well, but there were issues with the Outlook profile on the existing user workstation and the end result.
Not a huge issue for us as everything is stored in O365, but worth being mindful of if your email was hosted locally.
Also because of username convention changes, I had to set the ownership of the user profile to match the new shortened name.