CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in
Add ListingModify ListingTell A FriendLink to TPASubscribeNew ListingsCool ListingsTop RatedRandom Link
Newest Reviews
  • review
  • hagen software
  • NOT GPL!
  • Hagan Software
  • Wasted Time with ...
  • poor pre-sale sup...
  • no response
  • rating the offer
  • Good Stuff
  • Good idea but use...


  • Brochure Templates  
     
    Perl Archive : TLC : Programming : Perl : What is chmod?
    Guide Search entire directory 
     

    Date Published: 1999-08-01

    by Jennifer Hesse
    © 1999, CGI Script Center

    chmod changes the permissions mode of a file or directory in a CGI program.

    chmod and Permission Strings files that belong to you can be made private or world writeable. This is important because if your webpage is world writeable, then hackers can change your page with outyour knowledge. When in your Unix shell, you can type ls -l to get a printout of your files. Such a print out might look like this:

    -rw-r--r--   1 etracsvc other   1157 Jan 27 23:35 gayla.htm
    -rw-r--r--   1 etracsvc other   13095 Dec 10 11:58 hotanim.gif
    drwxr-xr-x   2 etracsvc other   4608 Mar  3 20:51 images/
    -rw-r--r--   1 etracsvc other   5257 Mar  3 08:35 index.htm
    -rw-r--r--   1 etracsvc other   4996 Feb 12 08:37 index.htmy
    -rw-r--r--   1 etracsvc other   1579 Jan 20 18:44 jasper1.htm
    -rw-r--r--   1 etracsvc other   13142 Jan 28 21:18 jeffsbio.htm
    -rw-r--r--   1 etracsvc other   5725 Jan 29 09:50 jukebox.htm

    The first column of the print out are the permission strings. These tell the computer who may or may not have access to files. There are 3 groups of letters sequenced, rwx (that is rwxrwxrwx). Each of the 3 groups define permission parameters for different users. The first set pertains to the owner, the second to the group and the third to the world. Without getting wrapped up in technical babble, what all this means is, if you give others permission to write to your files, your web page could get hacked. The letters pertain to specific characteristics:

    d=directory (all directories must have this)
    r=read (enables read for that group)
    w=write (enables write for that group)
    x=executable (makes file executable)

    In the permission string above, index.html is defined as -rw-r--r--. This means that only the owner can read and write to the file. The group (other) may read the file but not write, and the world may read the file but not write. If you create a file but the permission string gets changed to a world writeable file you must change the permission string by using the Unix command: chmod The table below shows some of the common chmod numbers: The command itself is,

    chmod [number] filename.
    400 r-------- files (won't let you accidently erase)
    444 r--r--r-- files (lets everyone read)
    600 rw------- files (no one else can read or see files)
    644 rw-r--r-- files (getting the idea?)
    664 rw-rw-r-- files 
    666 rw-rw-rw- files, (note: this could allow havoc of satanic proportions)
    700 rwx------ programs and directories
    750 rwxr-x--- programs and directories
    755 rwxr-xr-x programs and directories
    777 rwxrwxrwx programs and directories

    Note: 777 is a wide open executable script, this is dangerous.

    Jennifer Hesse is the Operations Manager at the CGI Script Center. Jennifer is also in charge of registration support and business development. She can be reached at jennifer@cgiscriptcenter.com.

     
     


    About The Perl ArchiveLink Validation ProcessSearch Tips
    Web Applications & Managed Hosting Powered by Gossamer Threads
    Visit our Mailing List Archives