Go Back   The macosxhints Forums > OS X Help Requests > System



Reply
 
Thread Tools Rate Thread Display Modes
Old 04-16-2012, 04:41 PM   #1
acme
MVP
 
Join Date: Jan 2009
Posts: 2,066
Access files on other partitions not booted?

In my rig, I have a Lion partition and a Snow Leopard partition.

is it possible for me to get access to...to copy files that are on the other partition which isn't booted and which is a different version of OS X?

Like...if I'm Root, can I open up the documents folder in the other partition and copy select files onto, say, an external drive?


thank you for any knowledge about this.

a
acme is offline   Reply With Quote
Old 04-16-2012, 04:54 PM   #2
NaOH
Hall of Famer
 
Join Date: Dec 2007
Posts: 3,788
I believe you'll be fine even without root-access enabled, though I'm not certain what will happen if you're in Snow Leopard and trying to get files from Lion if you have full-disk encryption enabled (aka FileVault 2). Of course, it would probably only take about 15 seconds to confirm if I'm correct.

From another angle, using the /Users/Shared folder may be easier, or a service like Dropbox.
NaOH is offline   Reply With Quote
Old 04-16-2012, 06:14 PM   #3
trevor
Moderator
 
Join Date: Jun 2003
Location: Boulder, CO USA
Posts: 19,804
I believe what will happen is that if you have root privileges (which I'd recommend getting temporarily using the 'sudo' command instead of logging into the GUI as root) you should be able to copy unencrypted files (in other words, files not on FileVault 1 or 2, and not inside an encrypted disk image) with no problem.

If you don't have root privileges, then you're in the interesting position that the name on the account doesn't matter, but the UID and GID and unix permissions (UID and GID are numbers, UID=User IDentification number, GID=Group IDentification number, 501 is the UID of the first account started on that partition, 502 is the UID of the second account started on that partition) are checked to see if you have permission to read, write, or execute a file.

I'm not sure how ACLs will work in this case, but I'd love to know--"allow" ACLs will probably not do anything, and "deny" ACLs will probably stop you as if you were a completely unregistered user on the system. Which you are, since you're on a different system doing the copying.

Trevor
trevor is offline   Reply With Quote
Old 04-16-2012, 06:16 PM   #4
acme
MVP
 
Join Date: Jan 2009
Posts: 2,066
So, if I went Root for the brief time it took to grab the files I want (my own computers) then would the folders in that other partition now sporting the Red circle with the line in it, loose that prohibit symbol?

...then, I'd do my business, un-root myself and all would return to as it was?
acme is offline   Reply With Quote
Old 04-16-2012, 06:47 PM   #5
trevor
Moderator
 
Join Date: Jun 2003
Location: Boulder, CO USA
Posts: 19,804
I believe that is all true, assuming no FileVault or other encryption. Still, I don't recommend enabling the root user, if you do this in the Terminal using sudo from your normal admin account you'll have a more secure system. If you must do it in the GUI, make triply sure that you have a VERY secure password on the root user.

When someone attempts to break into an unknown computer running unix, they won't know most usernames, meaning that they often guess common first names like "joe", "henry", "pete", "mary", etc. The only username that they know will exist on any unix system is root. Having a disabled root account means that the difficulty of breaking into a computer using dictionary attacks is thousands of times more difficult. Enabling root gives computer attackers a vector into the most powerful account on the computer.

Trevor
trevor is offline   Reply With Quote
Old 04-16-2012, 06:48 PM   #6
acme
MVP
 
Join Date: Jan 2009
Posts: 2,066
OK...I appreciated the significance of the risk in exchange for whatever convenience...think I won't do it that way...

thank you
acme is offline   Reply With Quote
Old 04-16-2012, 07:05 PM   #7
trevor
Moderator
 
Join Date: Jun 2003
Location: Boulder, CO USA
Posts: 19,804
To do it in the Terminal, you can use sudo and the cp command. So, let's say you're currently in Lion, and the partition with Snow Leopard installed on it is named "Snow Leopard". Then the command to copy a single file is

sudo cp /Volumes/"Snow Leopard"/path/to/file /path/to/destination/directory

Because of the 'sudo', you will be asked for your admin password. When you enter it, you won't see anything echoed back to the screen--this is normal. If you are using sudo for the very first time ever (in this account) you will get a warning about it's usage. This is also normal.

If you want to copy an entire folder, or a folder and all it's contents for as many levels as needed, then the command adds the -R flag, like:

sudo cp -R /Volumes/"Snow Leopard"/path/to/directory /path/to/enclosing/destination/directory

Feel free to play with cp with sample files, if you wish. For example, try

mkdir ~/"delete this folder"
touch ~/"delete this folder"/file1
touch ~/"delete this folder"/file2
touch ~/"delete this folder"/file3
mkdir ~/"delete this folder"/"another folder"
touch ~/"delete this folder"/"another folder"/file4
touch ~/"delete this folder"/"another folder"/file5


This creates a few sample files and folders inside your Home folder. (In the Terminal, your Home folder has the short name of '~'. ) The enclosing folder is named "delete this folder"--check in your Finder and you can see it, and some empty files inside it, along with yet another folder inside it called "another folder".

OK, now let's copy those someplace else:

cp -R ~/"delete this folder" ~/"another folder to delete"

That's cp in a nutshell, although what you're doing is more advanced, since you're copying from another partition and you're using sudo to gain temporary root privileges.

Trevor
trevor is offline   Reply With Quote
Old 04-16-2012, 08:14 PM   #8
ganbustein
MVP
 
Join Date: Apr 2008
Location: Berkeley CA USA
Posts: 1,159
Quote:
Originally Posted by trevor
sudo cp /Volumes/"Snow Leopard"/path/to/file /path/to/destination/directory

When you copy a file, you generally own the copy even if you didn't own the original EXCEPT that root goes out of its way to preserve ownership of files it copies.

If you couldn't access the original files to copy them without using sudo, you won't be able to access the copies without using sudo.

One way around the dilemma is to change ownership after the copy. Only root can change ownership, so you will need to invoke sudo.

ME=$(id -un)
sudo chown -R $ME /path/to/destination/directory



A much simpler method, though, is to simply disable owners on the "Snow Leopard" volume. That makes you, temporarily, owner of everything on the volume, and you can copy files from it to your heart's content, without using sudo. You will own the copies.

That's assuming you want to be the owner of the copies. If these are system files (roughly, anything outside /Users), you don't want to own the copies. You want ownership to be preserved, so what you want to do is enable owners on the Snow Leopard volume and use sudo to do the copy (or do the copy with Finder, which will ask for an admin password, and implicitly run sudo for you).

You enable/disable owners using the checkbox at the bottom of the Get Info window for the volume. You cannot disable owners for your current boot volume or for Time Machine's destination volume. The change is only effective while you're booted into the same volume you were booted into when you made the change, so even if you disable owners on the Snow Leopard volume they'll still be enabled whenever you're booted into it.
ganbustein is offline   Reply With Quote
Old 04-17-2012, 06:42 AM   #9
benwiggy
League Commissioner
 
Join Date: Aug 2006
Location: London
Posts: 5,705
I concur with ganbustein:

Just set the "Ignore ownership on this volume" flag on the drive, and then get the files you need.
benwiggy is online now   Reply With Quote
Old 04-17-2012, 10:27 AM   #10
trevor
Moderator
 
Join Date: Jun 2003
Location: Boulder, CO USA
Posts: 19,804
Good point, that's an effective way to do what's needed without using the Terminal, and without enabling root.

Trevor
trevor is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting 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

Forum Jump



All times are GMT -5. The time now is 05:43 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.