Troubleshooters.Com and Code Corner Present

Steve Litt's Perls of Wisdom:
chmod -- Changing File Permissions

Copyright (C) 1998 by Steve Litt

All operating systems have file attributes. They can be called permissions (UNIX), rights (Novell), attributes (DOS). Some are incredibly simple, like DOS, with their readonly, system and hidden attributes, while some are incredibly rich, like Novell with its read, write, create, delete, filescan, supervisor, accesscontrol.

Unix has three permissions, which can be given or denied to three different populations:

Owner Other All
Read Y/N Y/N Y/N
Write Y/N Y/N Y/N
Execute Y/N Y/N Y/N

You can see the file permissions by doing the ls command with the proper arguments. Below is an example. Note the column on the left indicates the permissions for the file for each user population.

-rwxr-xr-x   1 slitt    200         6331 Mar 24 18:33 big.cgi
-rwxr-x-wx   1 slitt    200          225 Mar 24 13:20 small.cgi
-rw-rw-r--   1 slitt    200         7791 Mar 24 18:30 robust.htm

Without getting into a big UNIX thing, I'd like to show you how to make a CGI script executable to all users. Note that CGI scripts must be executable to all in order for the HTTP server to execute them.

One way is to telnet in, and do the following command:

chmod a+x myfile.cgi

However, many ISP's won't let you telnet in -- it's too big a security risk. Never fear, you can do it from some versions of ftp. I use WS_FTP LE. To make a file executable to all, I simply click the file (in the remote side, of course) to highlight it, then right click it, choose chmod (UNIX). It presents me with this screen:

Click all 3 execute checkboxes, then (and please note this is important) make sure all 9 checkboxes represent the permissions you want the file to have. That's because the checkmarks you see when you pull up this window aren't necessarily accurate. Often you can check and re-check execute, and it's still not checked when you pull it up again. However, it IS now executable. What this means is that every time in WS_FTP that you pull up this screen, the checkboxes might not represent the file's present state, so you must make sure that all 9 checkboxes are exactly how you want them, or else you might unintentionally change rights you didn't want to change.

To find the real rights in WS_FTP, simply right click on a blank portion of the remote files window, and choose "directory listing". You'll get all the files, together with their attributes, exactly like if you'd done an ls -lt command. Note you can do the same from Windows95's built-in FTP by typing "dir" on their angle bracket prompt. Unfortunately, I could find no way of changing attributes from Windows95's built-in FTP.

Note: Click your browser's "back" button to return to the page you came from.

 [ | Code Corner | Email Steve Litt ]

Copyright (C)1998 by Steve Litt -- Legal