chmod 777 on my cgi-bin folder
Are you aware of what that command does? You just have made your cgi-bin directory writeable for every user on that machine!
The three digits following chmod encode permissions for the owner ("user"), the group ("group"), and all other users ("others", "world"), in this order. Each digit has the same meaning: 4 means reading allowed ("read", "r"), 2 means writing allowed ("write", "w"), 1 means execute file / crossing directory allowed ("execute", "x"). 0 means nothing allowed. Other digits are just sums, 7 means full permissings, 5 just read and execute/cross, 6 means read and write, but no execute. 3 (write and execute) is rarely used.
Common combinations are:
- 400, r--------
- read-only, only for the user. No permissions for group and world. Common for files that are secret (e.g. passwords) and should not accidentally overwritten.
- 600, rw-------
- read-write. Like 400, but writeable.
- 700, rwx------
- rwx for the user. A private, writeable program, e.g. a script with sensitive data. For directories, a private directory that nobody else may list, change, or even enter.
- 644, rw-r--r--
- readable for everyone, but writeable only for the user. The common mode for all kinds of non-executable files.
- 755, rwxr-xr-x
- like 644, but with executable flag set. The common mode for executable files and directories that may be listed by others.
- 711, rwx--x--x
- full access for the owner, but only executable permissions for group and others. Useful for binary executables (not scripts) that can be run by everyone, but nobody except the owner may read or write it. For directories, this allows to cross the directory, but non-owner users can't list or change them.
- 666, rw-rw-rw-
- Everybody may read or write, but not execute. Scratchpad. Don't trust such files.
- 777, rwxrwxrwx
- "Stupid mode", everybody may read, write, and execute. For directories, everybody may list and write to that directory. Except for the temporary directories /tmp and /var/tmp, this is almost always wrong. You want 755. (/tmp and /var/tmp also have the sticky bit set, but that's a different story.)
- 640, 750, 710, 660, 770
- as above, but limited to user and group. Others don't have access.
Alexander
--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.