|
|
|
|
|||||
|
|
|||||||
|
|
|
|
|
|
|||
|
|
|
|
|||||
|
|
|||||||
|
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
Topics |
|
-rwx------ has read, write and execute permissions for its owner only. This is the type of permissions generally preferred to prevent your private files from being accessed by anybody else but you. However, if your files are html documents in your home directory, for the server to send them out to the public, these files would need permissions such as: -rw-r--r-- which would allow the owner to read and write those files but give only read permissions to everybody else. This usually is the default for newly created files, even those created remotely by an ftp uploader. The above permissions would allow the server to access these files to be sent out. -rwx--x--x If a file called file.cgi needs its permissions set up that way, the proper command would be: chmod 711 file.cgi or chmod u+rwx,g-rw+x,o-rw+x file.cgi which would have the same effect. For a more extensive explanation on this command, you can use the UNIX online manual by issuing the command man chmod, or click here for more details. If your cgi script isn't a compiled program (executable binary) but is written in Perl, Tcl or other kind of "interpreted" scripting language, then you will also need to set the read permission along with the execute permission for the "others" part: -rwxr-xr-x Or that script won't run.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
A more practical way to specify the permission bits when using the chmod command is to use numbers instead of the u, g, o and r, w, x. These letters make a little more complex syntax for users who aren't familiar enough with the chmod command.
However, to use these numbers properly, their meaning must be understood. They are a symbolic representation in "octal" of the permission bits. Most of the time, only 3 digits are needed and knowing about the other possibilities isn't necessary for web users, as only the "superuser" or system administrator can modify such other permission bits (like the s or t). These octal digits each represent a set of 3 bits, the rwx permissions, and so can only take values of 0 through 7.
The examples below show the correlation between the 2 representations:
|
|
|
|
|
|
|
|
|
|
|
chmod |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
chmod |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
chmod |
|
|
|
See the table below for a translation of the possible values:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
When you need to know what octal number will be needed to
achieve the specific permission settings for a file or
folder, try this rule of thumb:
read = 100 = 4 write = 010 = 2 execute = 001 = 1
chmod o+x filename
But if you are not logged on with telnet, and just need to know the octal value, do it like this:
The existing permissions do not matter, as with the octal method, all bits will be set or unset exactly as the number says, so since we need read and write for "user", let's add 100 plus 010, which makes 110 or 6 in octal and makes the first (leftmost) digit. Then we only want to keep the read for "group", so 100 or 4 will be the second (middle) digit. Then lastly, we want to keep the read but also add execute for "others", so that's 100 plus 001, which makes 101 or 5 and the last (rightmost) digit. So the complete octal number is 645 (rw-r--r-x).
On the server with telnet, the command would be:
chmod 645 filename
(in both chmod commands above, filename is your file's name)
If you have a little more experience and are comfortable with the usual handling of your file permissions, there are more advanced ways to enhance the security and privacy of your information. There are 2 Unix commands available on the orbhost server, to handle these more advanced permission settings. These commands are:
getacl
and
setacl
and they allow setting up what are called ACLs (Access Control Lists), which are permission settings that goes beyond the regular Unix "user/group/others" model, and allow setting permissions for specific users and groups in addition to the already existing "user/group/others". This model allows much more "granular" precision on the settings of permissions. For example, to permit the http server to "serve" html files and their accociated pictures and resources to the "world", the permissions on those files must authorize read for "others", since the http server isn't the owner of the files and doesn't belong to the same group as the real owner of those files. But the "others" part of the standard permissions truly is too permissive, as it will authorize anyone access to the files. So, one application of the ACLs is to give permission only to the http server and nobody else besides the owner's user and group. This can be done with a command such as this:
setacl -u user:httpd:r-- filename
-rwxr-x---
with all 3 bits in the rightmost part ("others") unset. But the getacl command on these files would show an extra line:
user:httpd:r--
In the example above, "others" doesn't give any permissions to anyone, only the user and his group, plus the http server are authorized to access the files.
Thus, by setting the permissions for "others" to --- (no permission at all) on a folder containing html and accociated files, and setting the ACL for that folder with an extra user:http:--x then the http server will be able to function as usual while nobody else but the owner of the account will be able to list anything in the account.
All this can be applied with these couple of steps:
chmod o-rwx foldername
(to remove all permissions to "others")
setacl -u user:httpd:--x foldername
(to enable the "scan" only for the http
server)
|
|
|
[ Welcome | Home | Hosting | Design | News | Links | Search | Contact Us | Glossary ]
Send your comments about the site to the Webmaster
Copyright ©
1997,98,99,2000 orbhost
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
E-mail
the tech support |