How do I retrieve files from Time Machine backups from another computer?

14

17

Really it's the same computer - I just did a fresh install of Snow Leopard. When I try to open the Documents directory from my old user account I get

The folder "Documents" can't be opened because you don't have permissions to see its contents.

I think the problem is that my user account ID changed when I installed Snow Leopard. It was 503; now it's 501:

ls -al /Volumes/ExternalDriveName/Backups.backupdb/ComputerName/2009-09-03-120049/ComputerName/Users/
drwxr-xr-x@ 43 503    staff  1462 Jul 20 15:14 gaius

echo `id -g` `id -u`
501:20

I tried both chown -R and chmod -R, but both give me

Operation not permitted

I also tried changing the permissions via Inspector. They're all greyed-out, even when I authenticate as an administrator.

Any help?

James A. Rosen

Posted 2009-09-03T18:29:59.157

Reputation: 1 762

Answers

7

You could also invoke "Enter Time Machine" as root. That requires Finder to be started as root first, so only for those who understand the risks. In Terminal, for both Leopard and Snow Leopard:

sudo /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder

In Snow Leopard this does not (always?) open an initial Finder window. Do not click the Finder icon in the Dock (which might take you to your normal Finder), but use Command-Tab to go to Finder (which will be the new root-Finder). Here, hit Cmd-N for a new Finder window.

The new Finder looks like a normal Finder, but you'll notice root next to the home folder icon in Finder's sidebar. While the root-Finder is active, enter Time Machine (and once again validate that root is shown next to the home folder icon). This should allow you to browse, delete or restore what you need (but, for the original question: it won't solve your access issues permanently).

(As usual, holding down Option while clicking the Time Machine icon will change "Enter Time Machine" into "Browse Other Time Machine Disks" if you need to examine a disk that is not associated to your current machine. You might not need to be running as root to do that though!)

When done, eject the Time Machine volume if applicable. Next, hit Ctrl-C in Terminal to stop the root-Finder. The usual Finder will still be running, but in Snow Leopard the indicator in the Dock may have gone. Run killal Finder if that bothers you. (And if you forgot to eject the Time Machine volume while you were still root and the disk doesn't unmount properly at a later time, or if Time Machine won't mount it correctly when running its hourly backup, then you may simply log off as an easy fix.)

(If anyone knows how to do this without first running a root-Finder then please tell us! Running sudo "/Applications/Time Machine.app/Contents/MacOS/Time Machine" does not give the expected result, and I assume that the Time Machine galaxy window is in fact part of Finder. For the sake of search engines: "run time machine as root", "start time machine as root".)

Arjan

Posted 2009-09-03T18:29:59.157

Reputation: 29 084

I tested this in Snow Leopard, and it did not work. Do you need to quit Finder first? If so, how? – Josh Hunt – 2009-09-06T02:13:37.687

@joshhunt, I now tested in Snow Leopard as well and indeed, things are more confusing so I enhanced my answer. In fact, quitting the normal Finder makes things slightly less confusing, but then you'd need to add the Quit Finder menu option first, using defaults write com.apple.finder QuitMenuItem 1; killall Finder -- which I find quite useful to get rid of Desktop icons during presentations. Finder will always restart if no other program is running. When quitting Finder without starting a root-Finder one cannot use Enter Time Machine, so the galaxy is indeed part of Finder. – Arjan – 2009-09-06T11:47:43.943

21

It appears that Apple sets an ACL that denies everyone (root included) from deleting or modifying ownership etc on the Backups.backupdb folder and its contents, so using sudo or other root access does not help to change permissions.

drwxr-xr-x@   4 501   staff    136 18 Jun  2008 backedupfolder
com.apple.metadata:_kTimeMachineNewestSnapshot     50 
com.apple.metadata:_kTimeMachineOldestSnapshot     50      0: group:everyone deny add_file,delete,add_subdirectory,delete_child,writeattr,writeextattr,chown

everyone deny add_file,delete,add_subdirectory,delete_child,writeattr,writeextattr,chown

You can gain access to folders that are inaccessible by the current user by setting Ignore Ownership on the Time Machine volume. Unfortunately Apple have removed this from the Get Info window for volumes that are Time Machine volumes (or have been used as such in the past).

You will need to instead set the Ignore Ownership for a volume from the terminal instead.

vsdbutil -d '/Volumes/TimeMachineVolume'

You can reverse this using

vsdbutil -a '/Volumes/TimeMachineVolume'

As soon as TimeMachine runs again it will also re-enable ownership on the volume.

Charlie

Posted 2009-09-03T18:29:59.157

Reputation: 211

Still works in Mavericks (10.9.2). Thanks!! – Sean DeNigris – 2014-07-25T15:32:03.023

Wow, thanks! That totally did it! Great trick! – DataGreed – 2015-06-17T17:07:22.800

I'd highly recommend the OP set this as the correct answer. Side note: the ACL permissions can be revealed in Terminal by using the flags ls -le when listing the Backups directory of your Time Machine volume. – Ryder – 2015-06-29T13:37:28.297

1Yes, this just solved the problem for me too in OS X 10.10 Yosemite. Only thing is I had to use sudo vsdbutil -d 'Volumes/My Backup Drive' and type my password, because without it you now get 'You must be root to perform this operation'. Thanks Charlie! James, you should consider accepting this as the answer. – Jason S – 2015-08-29T02:19:49.970

1The vsdbutil trick worked great -- let me restore stuff from Time Machine that TM said I didn't have permission to restore. – dossy – 2012-01-11T04:46:44.367

This worked for me in Lion, unlike the "sudo Finder" trick from Snow Leopard, which crashed Time Machine. – Michael Cramer – 2012-03-31T15:02:34.443

Same experience as @MichaelCramer – Sammy Larbi – 2012-10-05T19:00:31.307

Simple, effective and reversible. Kudos! – phatmann – 2013-03-27T12:12:47.047

worked for me in Lion. Thanks soooo much!!!! – Eric O. Korman – 2014-03-29T18:36:06.813

2

on the command line you should be able to type

sudo su

and be authenticated as root. If the root user is unable to access the files, then you're most likely running into a data corruption problem.


Fixing Disk Corruption:
  • DiskWarrior - great for repairing HFS+ (mac formatted) drives, but not free
  • OnyX - Has some nice drive repair, free.

jweede

Posted 2009-09-03T18:29:59.157

Reputation: 6 325

Good thought, but it gives me the same error as sudo chown and sudo chmod. – James A. Rosen – 2009-09-03T19:35:38.243

2

I had a similar problem where I copied the Time Machine backup files back to my hard drive after a clean install of Snow Leopard. iTunes couldn't read the music directory and I had to type my password to trash the files. My fix was to remove the extended attributes for all the files. I don't have the script I used on me, but a Google search came up with this:

http://zzamboni.org/brt/2008/05/07/removing-all-extended-attributes-from-a-directory-tree/

hanleyp

Posted 2009-09-03T18:29:59.157

Reputation: 6 519

1

Okay so I'm not computer savvy by any means, but i have been puzzling over this for almost two hours now and i think i may have figured out something relatively easy that seems to be working.

When I would go into finder and select my external hard drive (which i called 'my life in virtual form) from the side bar, there would be several folders which would have this bizarre red minus sign in a circle at the bottom right corner. whenever i tried to open it, it liked to tell me finder couldn't open it because I didn't have 'permission...' whatever that means because I totally give myself permission to access my own writing.

Anyway, I took this file (the 'documents' folder from a backup of my old mac) and dragged it to the desktop. It copied it, still with that annoy little minus sign in the corner, but bear with me because this is where I stupidly stumbled onto my own genius. from the copied folder on my desktop, I then dragged it back over to the sidebar and dropped it into the 'documents' tap there. again, i had to wait for it to copy, and when it was finish, tada! magically I could go inside of it and open files from my old mac i apparently didn't have permission to see.

I have no idea why or how this worked for me, like i said, I tend to suck the life out of my technology faster than i do most anything else in life, but i now have access to these files after hours of scratching my head and being denied apparently by my own self. Hope this helps you guys and good luck!

Moira

Posted 2009-09-03T18:29:59.157

Reputation: 11

1

I just clicked on the restricted folder (in my case Desktop), clicked Restore and away it went. I had to choose the new location (or I could choose to recreate the original) and I just chose my desktop. Simple.

Trevor

Posted 2009-09-03T18:29:59.157

Reputation: 11

1

One successful method:

  1. I used Migration Assistant to migrate the account from the Time Machine backup onto the new Snow Leopard installation. If Snow Leopard sees that you're trying to migrate in an account whose name already exists, it will prompt you to create a new name. I did this.
  2. I logged in as the migrated account.
  3. I dropped everything I needed into my real account's Drop Box.

James A. Rosen

Posted 2009-09-03T18:29:59.157

Reputation: 1 762

1

Never try to change the permissions of or modify any file on a Time Machine backup. Use sudo to copy the entire Documents folder to your local drive, then chown -R.

s4y

Posted 2009-09-03T18:29:59.157

Reputation: 3 469

I couldn't even get sudo cp -r to work. – James A. Rosen – 2009-09-03T23:41:16.843