Srm (Unix) Explained

Secure Remove
Screenshot Size:250px

srm (or Secure Remove) is a command line utility for Unix-like computer systems for secure file deletion. srm removes each specified file by overwriting, renaming, and truncating it before unlinking. This prevents other people from undeleting or recovering any information about the file from the command line.

Platform-specific behaviours and bugs

Filesystems with hard links

Attempting to secure delete a file with multiple hard links results in a warning from srm stating that the current access path has been unlinked, but the data itself was not overwritten or truncated. This is an undocumented feature of srm 1.2.8 on Mac OS X 10.9, and is erroneously documented in 1.2.11 as a behaviour activated by the OpenBSD rm-compatible option -P.[1] However, in both the OS X and SourceForge srm implementations, the behaviour of unlinking but not overwriting multi-linked files is always active, as long as the platform reports hard links.[2]

srm 1.2.8 on Mac OS X 10.9 has a -n option, which means "overwrite file, but do not rename or unlink it."[3] However, if the file has multiple links, the multiple-link file data protection feature activates first, removing the file, even though the -n option specifies "do not rename or unlink the file". The -n option has been removed from the code and manual of srm version 1.2.11, the latest SourceForge.net version. As a consequence, this option/feature conflict does not occur.[4]

OS X

A number of file systems support file forks (called resource forks and named forks on OS X (particularly HFS+), and alternate data streams on NTFS), or extended attributes. However, OS X is the only platform on which srm securely deletes any of this additional data in files.[5] On OS X, only the most common non-data fork, the resource fork, is handled in this way.[6] This support was included in Appleā€™s 1.2.8[7] [8] and SourceForge's 1.2.9.[9]

srm was removed from OS X/macOS in v10.11 El Capitan, as part of the removal of the "Secure Empty Trash" feature for security reasons.[10]

OpenBSD

In srm 1.2.11, released on 25 November 2010,[11] the OpenBSD rm-compatible option, -P, is documented have an overwriting pattern matching OpenBSD's rm.[1] Additional functionality which protects multi-linked files is documented under the OpenBSD-compatible option, but is actually always active.[1] [6] [2]

Windows

When securely deleting files recursively, srm 1.2.11 is unable to determine device boundaries on Windows. Therefore, the -x option, which restricts srm to one file system, is not supported.

See also

External links

Notes and References

  1. Web site: srm - securely remove files or directories. 7 January 2014. Matt Gauthier. Matt Gauthier. Man Pages Section 1: Tools. srm 1.2.11.
  2. Web site: sunlink function in srm sunlink.c (SourceForge). 7 January 2014. doj, null_pointer at SourceForge. C Source. SourceForge.net. srm 1.2.11, sunlink.c CVS 1.44. 24 December 2013.
  3. Web site: srm - securely remove files or directories. srm 1.2.8, OS X Version 10.9. Apple Inc.. 7 January 2014. doj, null_pointer at SourceForge. Man Pages Section 1: Tools. 20 September 2004.
  4. Web site: srm main.c. 7 January 2014. doj, null_pointer at SourceForge. C Source. SourceForge.net. srm 1.2.11, main.c CVS 1.16. 9 June 2011.
  5. Web site: srm TODO. 7 January 2014. doj, null_pointer at SourceForge. Plain Text. SourceForge.net. srm 1.2.11, TODO CVS 1.34. 24 December 2013.
  6. Web site: sunlink function in srm sunlink.c (OS X). Darwin 13.0, OS X Version 10.9: Apple srm 7. Apple Inc.. 7 January 2014. Apple Inc., Matt Gauthier. C Source.
  7. Web site: Apple - Open Source. Darwin 13.0, OS X Version 10.9. Apple Inc.. 7 January 2014. Apple Inc..
  8. Web site: srm README.OsX (sic). 7 January 2014. doj, null_pointer at SourceForge. Plain Text. SourceForge.net. srm 1.2.11, README.OsX (sic) CVS 1.2. 22 November 2010.
  9. Web site: srm ChangeLog 2008-07-08. 7 January 2014. doj, null_pointer at SourceForge. Plain Text. SourceForge.net. srm 1.2.11, ChangeLog CVS 1.4. 25 November 2010.
  10. Web site: macbook pro - macOS High Sierra: Where is the Secure Empty Trash option? - Ask Different. 28 March 2021.
  11. Web site: secure rm - Browse files at SourceForge.net. 7 January 2014. doj, null_pointer at SourceForge. SourceForge.net.