Advertisement
Home arrow CGI and Perl arrow How can I change permissions on my cgi-bin files using FTP?
How can I change permissions on my cgi-bin files using FTP?
Tuesday, 02 November 2004
You can use your FTP software to set the proper permissions for your scripts in your cgi-bin.

About file permissions

For your CGI program to run, it must be executable by your Internet server. Therefore, you must set the permissions so the server can read or execute your files, which usually means making your CGI programs world executable.

Set your file permissions by using the CHMOD commands.
The CHMOD’s permission mask is a three-digit number. Each digit of the number defines the permission for a different user of the file.

The first digit defines the permission for the owner, the second digit defines the permissions for the group and the third digit defines the permissions for everyone else (referred to by CuteFTP™ as public).

Each digit works the same for each group of users: the owner, group, and public. What you set for one digit has no effect on the other two digits. Each digit is made up of the three Read, Write, and Execute permissions.

  • The Read permission value is 4,
  • The Write permission value is 2,
  • The Execute permission value is 1.

These three numbers are added together to get the permissions for a file. If you want a file to be only readable and not writable or executable, set its permission to 4. This works the same for Write and Execute. Executable only files have a permission of 1. If you want a file to have Read and Write permissions, add the Read and Write values together (4+2) and you get 6--the permissions setting for Read and Write. If you want the file to be Read, Write, and Execute, use the value 7 (4+2+1). Do this for each of the three permission groups and you get a valid CHMOD mask. If you want your file to have Read, Write, and Execute permissions (4+2+1) for yourself; Read and Execute (4+1) for your group; and Execute (1) only for everyone else, you would set the file permissions to 751.

  • chmod 755 filename is the most common permissions for cgi scripts. -rwxr-xr-x
    (owner=rwx, group=r-x, others=r-x)
  • chmod 775 dirname is the normal permission for a directory. drwxrwxr-x
  • chmod 664 filename is the normal permission for a non-executable file, i.e., an HTML or image file.
  • chmod 775 filename is the normal permission for an executable file, i.e., a shell script. -rwxrxxr-x
 

CuteFTP (Windows)

Changing Attributes of Files and Folders

(For advanced users only)

From the Menu Bar, use Commands/Change File Attributes to change the attributes of a file or folder on the server. In the Change Attributes dialog box, select the Read, Write, or Execute options for each group (Owner, Group and Public) or type in the corresponding CHMOD command in the manual box.

chmod 755 is the most common permissions for cgi scripts. -rwxr-xr-x
(owner=rwx, group=r-x, others=r-x)


WS_FTP (Windows)

With recent versions of WS_FTP:

Be sure you are connected to the Internet.
Launch WS-FTP
Connect to the remote site, and navigate to the directory with the file you want to change.
Select the file or directory whose permissions you want to change and right click on it
Choose chmod (UNIX)
Edit permissions by checking or unchecking the boxes.

Or, with an older version of WS-FTP:

Be sure you are connected to the Internet.
Launch WS-FTP.
Connect to the remote site, and navigate to the directory with the file you want to change.
Right-click in the remote pane.
Choose commands, then site.
Type "chmod ### filename" (no quotes) in the line provided.
(Where"###" are the appropriate permission numbers-- see below)

chmod 755 filename is the most common permissions for cgi scripts. -rwxr-xr-x
(owner=rwx, group=r-x, others=r-x)

Fetch (Macintosh)

Connect to the remote site, and navigate to the directory with the file you want to change. (For more on using Fetch, read the appropriate help file)
Go to the Remote menu.
Choose Send FTP Commands.
Type "site chmod ### filename" (no quotes) in the line provided.
(Where"###" are the appropriate permission numbers-- see below)

InterArchy

Set Permissions / Set Upload Permissions

FTP servers do not always correctly set the permissions of uploaded files. More accurately, their idea of correct and yours may not agree. FTP servers also do not always support the commands required to change the file and directory permissions of uploaded files. If they do support the semi-standard SITE CHMOD command, then Interarchy will let you modify the permissions manually, with the Set Permissions command.

You may also be able to set the default upload permissions by choosing Set Upload Permissions before commencing an upload (or mirror upload). Set Upload Permissions only lasts until you disconnect from the FTP server, so you will need to watch the transcript to see when you are logged out. If you commonly deal with an FTP server that has the upload permissions set inappropriately, you might try asking the server administrator to fix the permissions.

chmod 755 filename is the most common permissions for cgi scripts. -rwxr-xr-x
(owner=rwx, group=r-x, others=r-x)






Reddit!Del.icio.us!Google!Live!Facebook!Slashdot!Netscape!Technorati!StumbleUpon!Newsvine!Furl!Yahoo!Ma.gnolia!Free social bookmarking plugins and extensions for Joomla! websites!