Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Create and use secure tempfiles in scripts UNIX
While browsing through the tips, I saw several shell scripts that use a file in /tmp/ to store some temporary data. And each one was doing it in a insecure way. Please use mktemp to create a tempfile or directory in a secure way. See the manpage (man mktemp) for more inforrmation. There is a example section at the bottom.

For more background info on why this is important, see the article named Safely Creating Temporary Files in Shell Scripts. Note: mktemp can also create directories with the -d switch, which is better than the way the author describes.

    •    
  • Currently 3.33 / 5
  You rated: 4 / 5 (6 votes cast)
 
[4,518 views]  

Create and use secure tempfiles in scripts | 2 comments | Create New Account
Click here to return to the 'Create and use secure tempfiles in scripts' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create and use secure tempfiles in scripts
Authored by: hypert on Dec 23, '04 12:43:51PM

This is a good hint, although it appears the link to the article mentioned is effectively dead.



[ Reply to This | # ]
Updated link
Authored by: taran on Jul 25, '05 09:02:17PM