Skip Navigation
 Search | Directories | Reference Tools
UW Home > Discover UW > IT Connect > Unix > Unix Basics 

Protecting Your Account and Files

Included on this page:

Like a house or automobile, Unix computer accounts must be protected. If you are not careful, your account and files can be broken into, vandalized, or even stolen by unlawful computer users.

File and Directory Permissions and Access

You decide who can use your files and directories by setting permissions. Each file and directory has three types of permissions:
  1. Read (r) gives permission to view, print, and copy.
  2. Write (w) gives permission to edit, delete, and save.
  3. Execute (x) gives permission to run an executable file, such as a program. In the case of a directory, (x) allows you to change to that directory.

You set these permissions for three classes of users:

  1. You, the owner of the file.
  2. Your group.
  3. All others.

You can view the permissions of your files using the ls -l command. The ls -l command lists the contents of your directory in long format. For example:

  drwxr-xr-x 2 userid   512 Sep 14 08:24 Sales
  drwxr-xr-x 2 userid   512 Sep 14 08:24 Receipts
  -rw-r--r-- 1 userid   0 Sep 14 08:24 budget

Figure 3: Permission Settings for a File and a Directory

[Graphic: Permission Settings for a File and a Directory]

The first character indicates file type: a - (hyphen) indicates an ordinary file, and a d indicates a directory. Unix considers the next nine characters as three sets of three. The first set of three determines the owner's permissions, the second set determines the group's permissions, and the third set determines all others' permissions.

If you wish to change the permissions of a file or directory, you can use the chmod (change mode) command. The chmod command uses a number code. Each permission setting corresponds to a number between 0 and 7. For each file or directory, you assign three numbers between 0 and 7.

The following shows how the permissions correspond to each number code:

  7   Read, Write, and Execute   (rwx)
  6   Read and Write only   (rw-)
  5   Read and Execute only   (r-x)
  4   Read only   (r--)
  3   Write and Execute only   (-wx)
  2   Write only   (-w-)
  1   Execute only   (--x)
  0   No Permissions   (---)

To change the permissions of a file, enter:

    chmod  code  file

Where code is the three-digit number corresponding to the permissions you desire.

Note: When you set permissions for a file that you want others to use, you must make sure that your directories along the pathname leading to the file also have the appropriate permissions.

To set the permissions of a file so other users cannot read or write to it, enter:

    chmod 600  file

To see the new permissions for the file you specify, use the ls -l file commmand.
The permissions should now be -rw------

Change Your Password

You can help keep your account safe by choosing a hard-to-guess password.

To change your password, enter:


This initiates a program that first verifies your old password, then lets you type a new password, and finally asks you to retype your new password.

Keep these items in mind when choosing a password:

Managing Your Account

When you create an account on a Unix computer, you are given an allotment of computer resources. These resources include:

View Your Account Resources

The du (disk usage) command is useful for viewing the amount of disk space, measured in kilobytes, each of your directories occupies.

To view your account's disk usage, enter:


If you are like other Unix users, you may eventually use up your account's resources. Before you panic, try some of the following techniques: