File Directory Permissions Ownership


File & Directory Permissions & Ownership

If you've ever used file sharing on your Mac, you probably noticed that you can set permissions for folders and files, giving certain users, groups of users, or everyone read-only, read-write, or no access. (This is covered in Chapter 4.) Unix has almost the same system with users, groups, and public permissions.

Through the ls command, which I cover earlier in this chapter, you can learn quite a bit more about the ownership and permissions of files on your system. For example, take a look at the ls -la listing for a home directory, in Figure 57. There's lots of useful information on each line.

Figure 57. A directory listing including permissions and other information for files.


The first line (starting with the word total) is the number of 512-byte blocks used by the files in the directories that follow. Below that, each line contains seven columns of information about each subdirectory and file.

Permissions

The group of characters at the beginning of the line (for example, drwxr-xr-x in the first entry) indicates the entry's type and permissions.

The first character indicates the type of entry:

  • d indicates a directory.

  • - indicates a file.

  • l indicates a link to another file.

The next nine characters of the permissions can be broken into three sets of three characters each. The first set of three is permissions for the owner of the file, the second set is permissions for the group owner, and the third set is permissions for everyone else who has access to the entry.

  • r indicates read permissions. This permission enables the user to open and read the file or directory contents.

  • w indicates write permissions. This permission enables the user to make changes to the file or directory contents, including delete it.

  • x indicates execute permissions. For an executable program file, this permission enables the user to run the program. For a directory, this permission enables the user to open the directory.

  • - indicates no permission.

For example, the file named example.rtf in Figure 57 can be written to and read by the owner (ronh) and can only be read by the group (staff) and everyone else.

Links

The next column shows the number of links. This is a count of the files and directories contained within a directory entry. It's set to 1 for normal files.

Owner

The third column is the owner of the file or directory. Normally this will be the name of your account. Sometimes, the system creates files for you, and you may see another owner. For example, the .. directory in Figure 57 was created by the system, which gave ownership to root, the superuser.

Group

The group is listed next. Just as in file sharing in Mac OS 9.x and earlier, you can create groups of users that have separate permissions. To find out what group you are a member of, type groups and press .

When your account is created, a group is also created with the same name as your short name, with you as the sole member of the group. If you want special groups for people (for example, marketing, staff, sysadmins), you can set these up using NetInfo Manager if you are an administrator of the system.

File size

The number in the fifth column gives the size of the entry in bytes.

Modification date

The sixth column shows the date and time that the file or directory was last modified. A directory is modified whenever any of its contents are modified.

Filename

Last, you see the name of the file or directory.



Visual QuickStart Guide. Mac OS X 10. 4 Tiger
Mac Os X 10.4 Tiger (Visual Quickstart Guides)
ISBN: 0321423372
EAN: 2147483647
Year: 2003
Pages: 301
Authors: Maria Langer

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net