Hi John, you wrote... > Can someone please tell me if there's any reason not to write files > in /private/tmp rather than in /tmp/501/TemporaryItems ? > > drwxrwxrwt 29 root wheel 986 18 Jan 21:49 tmp > drwxr-xr-x 13 jd wheel 442 18 Jan 21:30 TemporaryItems > > So far as jd and admin there's never been a problem, but would there > be a problem if I were a user with fewer privileges?
The big difference between the two locations seems to be that anyone can read the files you drop into /tmp, while the files in /tmp/501 are protected from prying eyes. You can of course change the permissions on files that you make in /tmp so as to shield the contents (or change your umask), but you have the additional problem of not being able to overwrite a temp file owned by someone else. See File::Temp (standard module) for a nice, safe interface to the whole temporary file business. With regards to writing there's no problem: as per the permissions above, anyone can drop a file into the /tmp directory, but only the owner (or an admin using sudo or suchlike) can delete it. Cheers, Paul