Moving Files on the Harddrive

Titanium

Registered
every time i open my HD on MacOS X and want to move files and folders around that were there already from MacOS 9 i can NOT?!
a lil window pops up and tells me that i dont have enough privileges to complete the operation?! Now how can i as the ADMINISTRATOR not have enough privileges for ANYTHING in first place?? Second: i can move those files when i boot into MacOS 9 from the CD, i can btw NOT boot into MacOS 9 by holding down the option key or anything like that either!
hrmpf.
anyways.
i need to move folders and files and need to do that within MacOS X.
Anyone experienced this before and got the problem solved??
Thanks in advance,
the king of irons
 

rharder

Do not read this sign.
First, that's the OS X installer's fault. Anything in the root directory of your hard drive when you run the OS X installer becomes protected, for lack of a better word.

To fix it, you'll have to go into the Terminal. As root, either with <b>sudo</b> or <b>su</b>, you'll want to change the owner to your use name. Then you can move them to a more appropriate location.

I think the command you want would look something like this:
Code:
% <b>sudo chown -R <i>/TheDirectory</i> <i>username</i></b>
I may have the directory and username arguments reversed.

-Rob
 

Titanium

Registered
as a total and complete unix idiot do i have NO idea how to use the terminal whatsoever. so could you please explain those steps very slowly and in explicit detail? what does "the directory" and "use" stand for please?
thanks,
the king of irons
 

Elder Dan

Registered
First: Do NOT do recursive chowns and chmods on your system, especially against high-level directories such as /. There are uncountable system files which *have* to be owned by a certain user/daemon, and/or *have* to have certain permissions set on them, in order for the system to work. Changing your whole system over to having everything owned by your admin account, world-writable, will likely render your system non-bootable.

Second: Titanium, I assume your system has OS 9.1 and OS X installed on the same volume? When OS X is installed, it sets explicit permissions on the top of the volume (which the system calls "/") and also sets permissions on all the new files and folders it creates during the install.

The permissions that it sets on / are "1775". The last three numbers indicate what permissions are for the owner of the directory, the group that controls the directory, and finally everyone else. The owner of / is set to root and the group that is set is called "admin". The number 7 means that it is readable, writable, and executable (that is, applications can run from it). The number 5 means that it is readable and excutable, but not writable. So the "775" means that the root account can read and write to the root level of the hard drive, all accounts that are in group "admin" can read and write, and all other accounts are only able to read.

So why can't your admin user account delete stuff or move stuff that's in / (i.e. your hard drive root level)? Good question. That's where the "1" comes in. The 1 indicates that a thing called the "sticky bit" is set on that directory. This is roughly analogous to checking the little box in OS 9's File Sharing that says "don't allow users to delete or rename this item"-- in other words, while you can add new items to / and you can change the contents of items within /, you can't rename or delete the ones that already exist. So you can't move stuff away from where it already is.

Unfortunately, there is no way in Finder to see or alter the sticky bit. There are probably some third party tools out there that can manage it, but you can remove that irritating sticky bit quite easily from the Terminal command line with this command:

sudo chmod 775 /

"chmod" is the command that CHanges MODes on a file, i.e. alters its permissions. "chmod 775 /" means change the permissions on / (your root level) to 775 (no matter what it currently is). This is exactly the same as the existing permissions, minus the sticky bit.

However, because / is owned by the root account and only the owner of a file can chmod it, you have to execute the chmod with the authority level of the root account. That's what "sudo" does-- it executes whatever command follows it on the line with superuser power (that's where the "su" comes from-- DO this as Super-User). When you type this command, you will be asked to provide an admin password, and warned about the dangers of misuing "sudo". Give it your admin account password and it will execute the chmod correctly.

Then you should be able to move things in and out of the top level of your hard drive just fine.
 

rharder

Do not read this sign.
Elder Dan has good things to say.

Here's a quick step-by-step. I'm operating under the theory that you shouldn't use the root directory of the hard drive for stuff like we did in earlier OS's. Things should be stored somewhere in the Shared folder or in your Home folder. When I say "root directory" I'm not talking about the Unix term root, I'm talking about clicking on the "Macintosh HD" icon on the desktop and seeing a bunch of icons--that's the root directory I'm referring to.

Here we go.

Say you have a folder called "Some Docs" that's in this root directory, and you can't do anything with it. Let's move it to your Home directory which can be represented in Unix with the tilde (~) character.

Open the Terminal app (it's in the Utilities folder) and navigate to the "/" directory by typing this command (in bold):
Code:
% <b>cd /</b>
This is the equivalent of having that particular directory open in the Finder (but we're in the terminal mode).

Now we're going to change the permissions for that directory and everything within it. Here I assume that the documents are yours. Note we'll need to account for that space in the name. In the Terminal we do this by using a backslash (\) followed by a space:
Code:
% <b>sudo chown -R john Some\ Docs</b>
Replace "john" with whatever your login name is. When asked for your password, enter <em>your</em> password.

Finally we're going to move the directory someplace safe like your Home directory like this:
Code:
% <b>sudo mv Some\ Docs ~</b>
If you enter the second "sudo" command within five minutes of the first, it won't ask you for the password.

That should do it. Unix guys, have I left anything out?

-Rob
 

Titanium

Registered
Thanks Elder Dan!
did what you suggested. just copied and pasted the command line you were talking about into the terminal.
entered. got reminded to respect other people's privacy, prompted for my password, and could right away clean up my harddrive by putting folders where they in my opinion truly belong! :)
thanks a lot again.
what a great site this is!
The king of irons,
Titanium
 
Top