chiark / gitweb /
debian: Fix package sections.
[checkpath] / tmpdir.1
... / ...
CommitLineData
1.\" -*-nroff-*-
2.TH tmpdir 1 "6 April 1999" "Local tools"
3.SH NAME
4tmpdir \- choose, or check a choice of, temporary directory
5.SH SYNOPSIS
6.B tmpdir
7.RB [ \-bc ]
8.RB [ \-v
9.IR dir ]
10.SH USAGE
11The
12.B tmpdir
13program creates a secure place for temporary files to be stored, and
14outputs an assignment to the
15.B TMPDIR
16variable suitable for execution by a shell.
17.PP
18Many programs aren't sufficiently careful about how they handle
19temporary files. For example, if a program which creates files in
20.B /tmp
21without making careful checks beforehand, a malicious user who can
22predict the name that the program will use can create a symbolic link
23with that name: when run, the program will then overwrite some file
24using your current privileges. Similarly, many programs create
25temporary files using generous default permissions, which may well be a
26mistake.
27.PP
28The
29.B tmpdir
30program finds a secure place for temporary files, creating one if
31necessary. The criteria it uses to choose a place are as follows:
32.IP " 1."
33The temporary directory must be owned by the user, and have mode 700
34(i.e., readable, writable and searchable only by the owner).
35.IP " 2."
36The path through the filesystem to the temporary directory must be
37secure against modifications by other malicious users. See the
38.BR chkpath (1)
39manual page for a description of how this is done: the two programs work
40in the same way.
41.PP
42First,
43.B tmpdir
44checks to see whether the current value of the
45.B TMPDIR
46environment variable is a secure place for temporary files. If so, it
47is accepted immediately. Otherwise, it tries to find or create a
48directory in
49.B /tmp
50(on the assumption that this is a fast disk suitable for temporary
51files), with the name
52.BI /tmp/ user \- suffix
53for some
54.IR suffix .
55If that fails, it tries to create a directory in your home directory,
56with the name
57.BI ~/tmp\- suffix\fR.
58If
59.I that
60fails too, then
61.B tmpdir
62gives up: if your home directory's not secure (or full) than a secure
63temporary directory is the least of your worries.
64.SS Options
65The following options are supported:
66.TP
67.B "\-b, \-\-bourne"
68Output an assignment using Bourne shell syntax. The default is to
69examine the user's shell and decide which syntax to use based on that.
70.TP
71.B "\-c, \-\-cshell"
72Output an assignment using C shell syntax.
73.TP
74.BI "\-v, --verify " dir
75Don't try to find a temporary directory; just see whether
76.I dir
77is secure, and exit successfully if it is (and unsuccessfully if it
78isn't).
79.SH BUGS
80None known.
81.SH SEE ALSO
82.BR chkpath (1),
83.BR checkpath (3),
84.BR tmpnam (3),
85.BR tmpfile (3).
86.SH AUTHOR
87Mark Wooding (mdw@nsict.org).