Andre wrote: > Hi > I'm having a hard tile opening creating reading and writing files > with = perl on a unix palataform sometimes it works sometimes do no. > I suspect it has to do with permissions so can anybody tell me witch = > permissions must br set to perfom these actions properly (in numeric > = form ex: 755)
Make sure your umask is set to a reasonable value. It should be 022 or 02 unless you have a real good reason for it to be something else. This ensures that files are created with reasonable permissions. In order to open a file, you must have execute access to each directory named in the path passed to open. So: open(F, "</var/tmp/foo.txt") requires execute privilege in the directories /, /var, and /var/tmp If you open the file for read access, you must have read privilege on the file. To open for write access, you must have write privilege. Running a script requires the same privileges on the script file as described above for opening a file for read access. If you want to execute the script directly from the shell (i.e. # ./foo.txt instead of # perl foo.txt), you additionally need execute privilege on the script (and the #! line must point to your Perl interpreter). In the *general* case, using a umask of 022 (or 02) works well. Directories are created with 755 permissions and files are created with 644 permissions. When you chmod +x a a script, it changes to 755. If you need to share files across members of the same group, use 775 and 664 respectively. > on: 1-The directory in wich the perl script wull run execute and read bits for whoever needs to run the script. Again 755 is typical. > 2-The script file itself read bits for whoever needs to run the script, plus execute bits if running as an interpreter script (see execve(2)) or as a CGI script. > 3-The directory in wich the file that will be modified If the file already exists, you only need execute access on the directory. If you need to create the file or search for the file name, you'll also need write and read access, respectively. Again 755 is typical. > 4-The script file that will be modified (Created Deleted appended > et.) I assume you mean data file. 644 (or 664) is typical. Deleting a file requires write access to the directory. The permissions on the file are irrelevant (although rm(1) will issue a warning if you don't have write access to the file, you can still delete a file even if you don't have write access.) > 5_the upmost directory of my structure (i dont know if needed) > Thanks At a minimum, you need the execute bit if you use that directory in path names. But typically, you need read access as well (or you can't use ls(1), for example). Again, 755 is typical here. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]