How to open a finder window as root:

<http://yourmacguy.wordpress.com/2009/09/28/snow-leopard-root-finder/> 10.6
<http://yourmacguy.wordpress.com/2009/07/31/finder-with-root-access/> 10.5 and 
lower

Saved my butt today, fixing a department head's munged Powerbook...something 
ate his home directory, he could log on, but then it went to the background and 
nothing else ever appeared: no dock, no Desktop, etc.

FORTUNATELY (HINT HINT!!!) there was another user account with Admin privileges 
already present on the computer. I was able to log in as that user.

Here's the fix, if you ever find yourself in this situation.

Applejack found most or all of the missing pieces of his user directory 
structure and put it in /lost+found as a long series of numbered folders 
523343, 512244, etc etc..

(See:

<http://www.techworld.com.au/article/214899/unix_tip_rescuing_files_from_lost_found/>
<http://www.techradar.com/news/computing/apple/explained-lost-found-folder-in-os-x-712519>
 )

I logged in, renamed his now ruined home directory.

I had him log in; in the absence of a valid home directory, OS X will create a 
new, empty one.

I then logged back in as the first user (fast user switching roxxors), and 
opened a finder window as root, per the directions above. This now allowed me 
to open his normally locked home directory in the finder.

Then I looked through the myriad of folders in /lost+found. Fortunately it 
looked like most of his /library folder was one of them, most of his Pictures 
folder another, etc. I moved the files and folders into the appropriate places.

Once I was done in finder I want back to the terminal window where I started a 
finder instance as root and control-c'ed out of the command. Then I went to 
users and did: sudo chown -R theuser:thegroup theuser/

Whenere theuser is the user's short name, and thegroup is the user's group. 
This can be determined by the follwong command in Terminal:
        open a new Terminal Window and enter:
        cd /Users
        ls -l

You'll see something like this:

dbdev2:~ johnson$ cd /Users
dbdev2:Users johnson$ ls -l
total 0
drwxrwxrwt   18 root      wheel      612 Dec 14 16:31 Shared
drwxr-xr-x   21 helpdesk  helpdesk   714 Dec 15 10:42 helpdesk
drwxr-xr-x@ 260 johnson   johnson   8840 Apr 25 09:21 johnson
drwxr-xr-x   15 test      staff      510 Aug 20  2010 test

looking at the top line, root is the user, wheel is the group. Since 10.4 or so 
users have had their primary group one with the same name as their short 
username. (see helpdesk helpdesk, or johnson johnson). IN earlier versions of 
OSX your default group was 'staff'.

The chown command above makes sure that all the files in the user's directory 
are owned by him (CHange OWNership) since root was moving (and in some cases 
copying) the files many could have been owned by root)

After this, he was able to log in again and most of his stuff was as he left it.

I was still getting problems booting up as in taking 5-10 minutes to boot (In 
10.6, possibly 10.5, if the system boots up with a long progress bar like a 
safe boot, fsck is having problems with the drive. In earlier versions of the 
OS I think the spinning gear just keeps on spinning, making it appear that 
nothing is going on) It would eventually boot but take forever.

(Another useful hint: I rebooted holding down the Command-V keys; this boots in 
'verbose' mode, showing the old school Unix boot screen, where I was able to 
see that the system was repeatedly trying to repair the disk with fsck)

Connected it via FWTM to my iMac, tried Disk Utility to repair, no go. Tried 
Disk Warrior and DW once again proved it's worth, by handily rebuilding his 
disk directory and restoring his system back to normal.

His external drives for Time Machine (which I suggested he get a YEAR AGO!) are 
now winging their way here...

Caveat! 

As with ANYTHING done as root, you can really screw up the system. Using Finder 
like this is taking a heavy-duty power tool, removing all the safety guards, 
duct taping it to your hands and supergluing the trigger to the 'ON' position. 
If you don't know what you're doing, you can lop off a limb before you know 
what happened to you...

Use wisely :-)

-- 
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group

Institutions do not have opinions, merely customs


-- 
You received this message because you are a member of G-Group, a group for 
those using G3, G4, and G5 desktop Macs - with a particular focus on Power Macs.
The list FAQ is at http://lowendmac.com/lists/g-list.shtml and our netiquette 
guide is at http://www.lowendmac.com/lists/netiquette.shtml
To post to this group, send email to g3-5-list@googlegroups.com
For more options, visit this group at http://groups.google.com/group/g3-5-list

Reply via email to