UNIX Permissions

UNIX allows certain users access to files and commands by setting permissions to ensure that only legitimate users are permitted access to files and directories.

To view information about each file, use the -l flag with the UNIX command ls (for example, ls -l). The command ls -s lists the current UNIX permissions. To display both the file permissions and file information, combine the flags -s and -l with the command ls (for example, ls -sl or ls -ls). Figure 6-2 displays a sample output for the command ls -ls for a UNIX host named Simon.

Figure 6-2 also displays a sample output of the command ls -sl and explains the meaning of this output.

Figure 6-2 ls -sl Command Output

Permissions Key:

r—Read permission. Allows the file to be looked at but not modified. w—Write permission. Allows the file to be modified. x—Search/execute permission. Used for programs or directories. Allows a program to be run or a directory entered and modified. Also can be s.

User/Owner Permissions

Permissions that have been set for other, which refers to anybody outside of the owner and group ill


f > 'V

f 1 V-

r--f- 1 echernof2186 Aug 6 20:00 index1.html


Permissions for a group of Users

- Indicates a file d Indicates a directory l Indicates a link

- Indicates a file d Indicates a directory l Indicates a link

Example Displayed from a UNIX Host Named Simon

Simon% ls -sl

total 2

0 drwxr-xr-x

2 hbenjami sys

96 Sep 8 1999 Mail

2 -rw

1 hbenjami mail

3 Sep 11 17:32 dead.letter

When a new file is created in UNIX, the default is to define read and write access to the owner. To set new or modify permissions, use the command chmod flag filename.

The chmod flag is always three numbers. The first number affects the owner permissions (U), the second number affects the group permissions (g), and the third number affects the other (o) permissions. Each number can be a number between 0 and 7; Table 6-3 displays the possible values for each flag.

Table 6-3 chmod Flag Definitions




No permissions


Execute only


Write only


Write and execute


Read only


Read and execute


Read and write


Read, write, and execute

NOTE The network administrator is typically given the root password allowing configuration changes, program execution, and file management. For example, to connect a new hard drive, the installation engineer requires the root password. The administrator types in the root password first. After entering the root password, the administrator types the UNIX command mount to attach or detach a file system, also known as the super user.

Was this article helpful?

0 0

Post a comment