mktemp.1 (79755) | mktemp.1 (95124) |
---|---|
1.\" Copyright (c) 1989, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. --- 16 unchanged lines hidden (view full) --- 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" From: $OpenBSD: mktemp.1,v 1.8 1998/03/19 06:13:37 millert Exp $ | 1.\" Copyright (c) 1989, 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice, this list of conditions and the following disclaimer. --- 16 unchanged lines hidden (view full) --- 25.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30.\" SUCH DAMAGE. 31.\" 32.\" From: $OpenBSD: mktemp.1,v 1.8 1998/03/19 06:13:37 millert Exp $ |
33.\" $FreeBSD: head/usr.bin/mktemp/mktemp.1 79755 2001-07-15 08:06:20Z dd $ | 33.\" $FreeBSD: head/usr.bin/mktemp/mktemp.1 95124 2002-04-20 12:18:28Z charnier $ |
34.\" 35.Dd November 20, 1996 36.Dt MKTEMP 1 37.Os 38.Sh NAME 39.Nm mktemp 40.Nd make temporary file name (unique) 41.Sh SYNOPSIS --- 59 unchanged lines hidden (view full) --- 101be taken to ensure that it is appropriate to use an environment variable 102potentially supplied by the user. 103.Pp 104Any number of temporary files may be created in a single invocation, 105including one based on the internal template resulting from the 106.Fl t 107flag. 108.Pp | 34.\" 35.Dd November 20, 1996 36.Dt MKTEMP 1 37.Os 38.Sh NAME 39.Nm mktemp 40.Nd make temporary file name (unique) 41.Sh SYNOPSIS --- 59 unchanged lines hidden (view full) --- 101be taken to ensure that it is appropriate to use an environment variable 102potentially supplied by the user. 103.Pp 104Any number of temporary files may be created in a single invocation, 105including one based on the internal template resulting from the 106.Fl t 107flag. 108.Pp |
109.Nm Mktemp 110is provided to allow shell scripts to safely use temporary files. | 109The 110.Nm 111utility is provided to allow shell scripts to safely use temporary files. |
111Traditionally, many shell scripts take the name of the program with 112the pid as a suffix and use that as a temporary file name. This 113kind of naming scheme is predictable and the race condition it creates 114is easy for an attacker to win. A safer, though still inferior, approach 115is to make a temporary directory using the same naming scheme. While 116this does allow one to guarantee that a temporary file will not be 117subverted, it still allows a simple denial of service attack. For these 118reasons it is suggested that --- 77 unchanged lines hidden --- | 112Traditionally, many shell scripts take the name of the program with 113the pid as a suffix and use that as a temporary file name. This 114kind of naming scheme is predictable and the race condition it creates 115is easy for an attacker to win. A safer, though still inferior, approach 116is to make a temporary directory using the same naming scheme. While 117this does allow one to guarantee that a temporary file will not be 118subverted, it still allows a simple denial of service attack. For these 119reasons it is suggested that --- 77 unchanged lines hidden --- |