InfiniteMac OSx86  


Reply
 
Thread tools Display modes
  #1  
Old 03-05-2009, 08:59 PM
LawlessPPC's Avatar
LawlessPPC LawlessPPC is offline
 
Join Date: May 2008
Location: United Kingdom
Posts: 506
chmod what the numbers mean (small guide)

ever wanted to know what the 775 you so commonly see used after chmod means? Well today i found out after days of trying to work out why i couldnt edit some mp3 tags. I finally found out it was a permissions issue and with the help of the following (which is a copy and paste) I was able to set the right permission for all my mp3's in one foul swoop. Enjoy

Changing file permissions on the Mac is something you need to know how to do if you want to create your own non-home directory only shares on the Mac. Leopard implements folder sharing similarly to the way SharePoints does. I find myself needing to change permissions regularly because certain programs like to change file permissions on their own. The Terminal is generally better for changing permissions because it is much faster and also because you have more control. Sometimes you may need to do this is the file permissions get messed up in Leopard’s File Sharing under System Preferences.
Another issue for id3tag woes in itunes is you must make sure all tags are id3v2.3 UTF 16.

Here’s how it works:


* First, open the Terminal, then use the command ‘cd‘. For example, if you wanted to change to your Desktop directory, you would type:

cd ~/Desktop

to change to your desired directory. Note that the tilde ‘~’ represents your home directory.
The command ‘ls‘ then shows the files within the current directory. You can also use:

ls -la

The ‘l’ switch lists files in long format, and the ‘a’ switch lists all files, including hidden ones.
If you are the owner of a file, you have the ability to change its permissions with the command:

chmod

There are several ways chmod can be used, however I will only focus on the octal system. The first number represents the owner’s permission, the 2nd represents the groups permission, and the last one represents the world’s or everyone’s access. The permission is calculated using simple arithmetic.

The first number represents the access granted to the file’s owner. The next number, represent access granted to the file’s group owner, and the last number represents everyone else’s level of access. The possibilities for permissions include: read (4), write (2), execute (1), and no permission (0).

The permission is set using the chmod command:

chmod 755 filename

However a more practical use of the command would be:

sudo chmod -R 755 /directoryname

This command will recursively change the permissions on all files and folders contained within that directory because we used -R.

Okay, so just to rehash again:
The 7 comes from 1 + 2 + 4. This means read, write and execute permission (for the owner).
The 5 comes from 1 + 4. This means execute and read permission (for the group).
The 5 comes from 1 + 4. This means execute and read permission (for everyone).

This means that the file’s owner has read, write, and execute permission, but group and world only have read and execute permissions. Managing file permissions on the Mac isn’t that difficult once you get the hang of it. And doinging it youself if more powerful that using Disk Utiity, however you should take care as you can screw things up when using the sudo (root permission) command.


Original source:- http://brockwoolf.com/change-file-pe...al-in-mac-os-x



💡 Deploy cloud instances seamlessly on DigitalOcean. Free credits ($100) for InfMac readers.



Last edited by LawlessPPC; 03-06-2009 at 12:40 AM.
Reply With Quote