Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > Moving a user from root after extended use

Moving a user from root after extended use
Thread Tools
Fresh-Faced Recruit
Join Date: Oct 2001
Location: Orlando, Florida
Status: Offline
Reply With Quote
Mar 22, 2004, 03:05 PM
 
I went to a school to help a user set up the mail client correctly on their Mac.

When I got there I found out someone enabled root access and she has been using root as her logon for about six months. I started to create a new user but then I realized she would need to reset all her preferences on the new account (she went nuts) and I would have to move all her data files.

Well Root doesn't have a user folder so it was not immediately apparent just where all her data was and since this user seemed particularly anxious I didn't want to upset things so I left her as she was for now.

What's the best way to preserve this users data and move it to a normal admin account?
     
Mac Elite
Join Date: Feb 2001
Location: Washington, DC
Status: Offline
Reply With Quote
Mar 22, 2004, 03:41 PM
 
Root has a user folder, but it's typically not in the Users dir.

Here's a quick and dirty way to copy everything over:
[list=1][*]Make the new User Account for this person, and make note of the short name[*]open terminal as the newly created user[*]sudo cp -R ~root/* ~/ && sudo chown -R <new user's short name>:<new user's short name> ~[*]Deactivate the root account[*]Logout[/list=1]

That should copy everything over, preserve permissions on all her doc's, prefs, etc.

If you have the DevTool's insatlled, it might be safer to replace cp with /Developer/Tools/CpMac. That will ensure any resource forks get copied as well as the data. All the rest of the arguments remain the same. Actually... don't do this at all, unless CpMac exists, or you're absolutely sure stripping the files of their resource forks won't harm anything. You could just copy CpMac onto the machine from another one with the DevTools installed though.

FYI: in terminal ~ aliases to your home dir, and ~[user] will alias to that user's home directory. So if you had a user named foo, and you were logged in as bar, but you wanted to get a file from foo's home dir quickly -- all you'd have to type is cp ~foo/path/in/home/dir/to/file ~/path/in/home/dir/to/destination. It's an especially useful trick when working on multiple systems with different paths to home directories.
(Last edited by Earth Mk. II; Mar 22, 2004 at 03:46 PM. )
/Earth\ Mk\.\ I{2}/
     
tRr
Dedicated MacNNer
Join Date: Aug 2002
Location: Toronto
Status: Offline
Reply With Quote
Mar 23, 2004, 01:50 AM
 
Very well said! Even I get parts of it

Originally posted by Earth Mk. II:
Root has a user folder, but it's typically not in the Users dir.

Here's a quick and dirty way to copy everything over:
     
Xeo
Moderator Emeritus
Join Date: Mar 2001
Location: Austin, MN, USA
Status: Offline
Reply With Quote
Mar 23, 2004, 02:50 AM
 
you don't need CpMac or the DevTools to make sure the resource forks stay intact. Just use "ditto -rsrcFork" instead of "cp -R" in that command above. ditto come standard w/ OS X so it will be there.

In fact, you could just replace his #3 with:

3. sudo ditto -rsrcFork ~root ~ && sudo chown -R <new user's short name>:wheel ~
(Last edited by Xeo; Mar 23, 2004 at 02:59 AM. )
     
Grizzled Veteran
Join Date: May 1999
Location: Seattle
Status: Offline
Reply With Quote
Mar 23, 2004, 04:57 AM
 
Personally if I were unscrewing a system where a user had been unwittingly using root access I would do a clean install of the OS and all the programs.

You can copy a user's files to an iPod and copy them back to any user and they will have the proper ownership.

Do not set this person up with an admin account for daily use.
1.25GHz PowerBook


i vostri seni sono spettacolari
     
Mac Elite
Join Date: Feb 2001
Location: Washington, DC
Status: Offline
Reply With Quote
Mar 23, 2004, 10:15 AM
 
Originally posted by Xeo:
you don't need CpMac or the DevTools to make sure the resource forks stay intact. Just use "ditto -rsrcFork" instead of "cp -R" in that command above. ditto come standard w/ OS X so it will be there.

In fact, you could just replace his #3 with:

3. sudo ditto -rsrcFork ~root ~ && sudo chown -R <new user's short name>:wheel ~
heh, totally forgot about ditto.

thanks
/Earth\ Mk\.\ I{2}/
     
Xeo
Moderator Emeritus
Join Date: Mar 2001
Location: Austin, MN, USA
Status: Offline
Reply With Quote
Mar 23, 2004, 02:22 PM
 
I just thought of an even easier #3.

sudo ditto -rsrcFork ~root ~ && sudo chown -R `whoami`:wheel ~

Takes all the guesswork out. Now it's a general purpose command which will copy the home of root into your home and fix the permissions. Note: Ditto will overwrite any duplicate files and merge all non-duplicate files in duplicate directories into the same dir. So you will have everything in ~root, and everything that doesn't exist in ~root but exists in ~.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:14 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2