Up to main menu         Back to Shell Scripts         Next: Internet Facilities

Read/Write/Execute Permissions

To see who has permission to read/write/execute a given file (or directory), use ls -l;
    pascal>  ls -l myprogram.f90

-rw-r--r--   1 smith   math6000     1152 Sep  5 10:32 myprogram.f90
The 10 characters at the far left of this ``long'' listing indicate the permissions for the file; in this case, "smith" (the owner of the file) has read & write permission but everybody else only has read permission. (See ``How to Change Permissions''.) The interpretation of those 10 characters:

Examples

    pascal>  ls -l file1
-rw-------  2 smith    math6000     3287 Apr  8 12:10 file1

The owner of the file has read and write permission.


    pascal>  ls -l file2
-rw-r--r--  2 smith    math6000    3287 Apr  8 12:11 file2

The owner has read and write permission. Everyone else - the group and all other users - can read the file.


    pascal>  ls -l myprog
-rwx--x--x  2 smith    math6000    3287 Apr  8 12:10 myprog

The user has read, write and execute permission. Everyone else -the group and all others- can execute the file.


    pascal>  ls -l
drwxr-x---  2 smith    math6000    1024 Jun 17 10:00 SCCS

This is a directory. The user has read, write and execute permission. The math6000 group has read and execute permission on the directory. Nobody else can get access to it.


How to Change Permissions

Use the Unix command chmod to change the permissions on a file or directory that you own. (It won't work on somebody else's file!) The manual page for chmod gives several variations of usage, but the most direct method is to give a 3-digit code with the command to set permissions for yourself, your group, and the world. Each of the 3 digits reflects the sum of the three kinds of permissions; read=4, write=2, execute=1.
Up to main menu         Back to Shell Scripts         Next: Internet Facilities
Bruce.Fast@Colorado.EDU