Bug 21702 - script follows symlinks.
script follows symlinks.
Product: Red Hat Linux
Classification: Retired
Component: util-linux (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Erik Troan
Dale Lovelace
: Security
Depends On:
  Show dependency treegraph
Reported: 2000-12-04 17:08 EST by Jeremiah Johnson
Modified: 2007-04-18 12:30 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-02-06 15:55:33 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Jeremiah Johnson 2000-12-04 17:08:11 EST
The program "script" from util-linux does not check for file existence
prior to writing output.  By default script writes to a file called
"typescript", it can be made to write to other files as well.  If a symlink
exists in the place of the typescript file, the file linked could be
destroyed if the user running script has proper privledges.  

[miah@workie miah]$ echo "pleh" > peh
[miah@workie miah]$ ln -s peh typescript
[miah@workie miah]$ ls -l peh typescript
-rw-rw-r--    1 miah     miah            5 Dec  4 02:19 peh
lrwxrwxrwx    1 miah     miah            3 Dec  4 02:19 typescript -> peh
[miah@workie miah]$ script
Script started, file is typescript[miah@workie miah]$ ls peh
[miah@workie miah]$ exitScript done, file is typescript
[miah@workie miah]$ cat peh
Script started on Mon Dec  4 02:19:44 2000
[miah@workie miah]$

This problem exists in newest version of util-linux and seems to exist in
all other versions of script.  Other platforms/OS's are effected by this
too (including Openbsd 2.6/BSDi 4.1)
Comment 1 Erik Troan 2001-02-06 15:55:27 EST
This isn't a bug. Most unix command line utilities follow symlinks. It may cause
surprising behavior, but it is correct.

Note You need to log in before you can comment on or make changes to this bug.