Thread: file does not open!

  1. #16
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    Yep, those would be the permissions...

  2. #17
    Registered User
    Join Date
    Mar 2010
    Posts
    85
    webserver: rwx r-x r-x me me
    index.html: rw- rw- rw- me me
    index2.html: rw- rw- rw- root root
    403.html: rw- r-- r-- me me

    before webserver has been compiled it is rwx r-- r-- but thats before so it shouldnt really matter

  3. #18
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    You have to understand the difference between ownership and permissions. In short, the owner (and root) can change permissions on a file. The permissions dictate who can read, write and execute the contents of the file. Your index.html is owned by user me, group me. The first group of rw- means the user "me" can read and write the file. The second group of rw- means any user in group "me" can read and write the file. The last group of rw- means anybody on the system can read and write the file.

    For index2.html, user root can read and write. Anybody in group root can read, and anybody on the system can read.

    For 403.html, user me can read and write. Anybody in group me can read, and anybody on the system can read.

    If you want to test reporting of a 403 error, you need to change the permissions on index2 to something that can't be read by whoever is running the webserver*. You can actually do "chmod 000 index2.html" (don't worry, you can change the permissions back later).

    * I say whoever is running the web server, because even though it's owned by me:me, if user "foo" of group "bar" invokes your web server, it runs under their permissions (unless you have the setuid and/or setgid bits set).

    Now seriously, go read some good tutorials on Linux file ownership and permissions.

  4. #19
    Registered User
    Join Date
    Mar 2010
    Posts
    85
    thanks for the help ill try this out in the morning and report back here
    regards

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 09:35 AM
  2. Need Help Fixing My C Program. Deals with File I/O
    By Matus in forum C Programming
    Replies: 7
    Last Post: 04-29-2008, 07:51 PM
  3. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM
  4. Ghost in the CD Drive
    By Natase in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 10-12-2001, 05:38 PM