Free Web Hosting by Netfirms
Web Hosting by Netfirms | Free Domain Names by Netfirms

[ . ]
 
[ Web Magic ]

CHMOD
Setting File Permissions

[ line ]

The chmod command in UNIX is what you use when you want to control access to a specific file for reading, writing and executing

The chmod command is similar to DOS's attrib command but goes a few steps further: UNIX allows for several users to access the same file. The different users are broken up into three categories: user, group and others. There is also a category called all, which encompasses the other three categories.

With the chmod command you specify what permissions are given to each category of users. The permissions that can be given to a file are many, the most commonly used are read, write and execute.

The permissions given are for reading, writing, and executing. They have different meanings for ordinary files and directories. Caution: It is possible for you to lock yourself out of one of your own files with chmod. Be careful when you type it.

For an ordinary file, permissions are defined as follows:

read . . . . . . . . . you may look at the contents of the file
write . . . . . . . . . you may change the contents of the file or delete it
execute . . . . . . you may execute the file as if it were a Unix command.

For a directory, permissions are defined as follows:

read . . . . . . . . . you may see the names of the files in the directory
write . . . . . . . . . you may add files to and remove files from the directory
execute . . . . . . you may change to the directory, search the directory, and copy files from it.

The characters used to represent these permissions are:

r . . . . . . . . . read permission
w . . . . . . . . write permission
x . . . . . . . . .execute permission
- . . . . . . . . . permission denied

Note that each permission also has a number assigned to it. The sum of these numbers determine the digits of the chmod. For example:

7 . . . . . can read, write and execute permissions (4 + 2 + 1)
6 . . . . . can read and write. (2 + 4)
5 . . . . . can read and execute. (4 + 1)
4 . . . . . can read file only
3 . . . . . write and execute file (2 + 1)
2 . . . . . can write file only
1 . . . . . can execute file only
0 . . . . . can't do anything

So, if the permission is 755, then the owner has all permissions, and both group and other have read and execute.
PERMISSIONCOMMAND
UserGroupWorld 
rwxrwxrwx chmod 777
rwxrwxr-x chmod 775
rwxr-xr-x chmod 755
rw-rw-r-- chmod 664
rw-r--r-- chmod 644

Some modes that are often useful in a typical CGI context are:

CGI programs . . . . . 755
data files to be readable by CGI . . . . . 644
directories for data used by CGI . . . . . 755
data files to be writable by CGI . . . . . 666 (data has absolutely no security)
directories for data used by CGI with write access . . . . . 777 (no security)
data files for setuid CGI programs . . . . . 600 or 644
directories for data used by setuid CGI programs . . . . . 700 or 755

[ line ]

[ Back to Top | Home ]

Free Web Hosting by Netfirms
Web Hosting by Netfirms | Free Domain Names by Netfirms

[ Creative Computing ]

[ Recommend Our Site ]     [ Creative Computing ]     [ HTML 3.2 Validated ]

Copy & Copyright (c) 1998 - 2006   Creative Computing

Free Web Hosting by Netfirms
Web Hosting by Netfirms | Free Domain Names by Netfirms

Please Click To Visit Our Friends At:
Home

Free Web Hosting by Netfirms
Web Hosting by Netfirms | Free Domain Names by Netfirms

HTML Tips
HTML Validation
CGI Tips
Web Security
Search Engines
Spam Mail

Online Services
META Tag
    Generator

Web Whois

Site Resources
Site Links
Earn Cash

DBMan FAQ

Creative Computing

Contact
Guest Book

[ Recommend ]

[ Site Map ]

    [ Cross ]

[ Creative's Health News ]

[.]