in reply to CHMOD permissions for Perl Script

rwxrwxrwx = read write execute for user group and world

the first three rwx are for user perms
the second three rwx are for group perms
the last three are world perms


r=read
w=write
x=execute


rwxr--r-- = user has read write execute, group has read, and the world has read perms...

as for your script it depends on what you ae doing - how safe does it ned to be, what uid si your script running as, etc...

Replies are listed 'Best First'.
Re^2: CHMOD permissions for Perl Script
by comfixit (Initiate) on Dec 29, 2004 at 22:14 UTC

    I will be getting a string from a textarea tag that was posted to the script.

    That posted string will contain the entire HTML of the file I want to create.

    So I am writing that information to a file in a temporary directory. Then I use Net::FTP to copy the file from the temporary directory to the main directory which has very restrictive permissions but permits FTP transfers. After that I delete the temporary file.

    What I want to do is give the TEMP directory sufficient permission so that the script can write the file, and then eventualy delete it. But not enough permission that a random person could upload a script and run it.

    At present I seem to have to give "Other" or world permission to write & execute for the script to be able to write the file without error even through the script that is creating the file is in the regular CGI-BIN directory. I would have thought that execute permission would not be neccessary for a file write if the executing file was in a different directory (my CGI-BIN) but this does not seem to be the case.

      perldoc IO::File is your friend