{{Lowercase title}} {{more citations needed|date=August 2010}} {{Infobox software | name = Secure Remove | screenshot = Secure remove.png | screenshot size = 250px | caption = srm securely erasing a text file. }} '''<code>srm</code>''' (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,<ref name="OSX_man"/> and is erroneously documented in 1.2.11 as a behaviour activated by the OpenBSD rm-compatible option <code>-P</code>.<ref name="Unix_man">{{cite web|title=srm - securely remove files or directories|accessdate=7 January 2014|author=Matt Gauthier|author-link=Matt Gauthier|location=Man Pages Section 1: Tools|url=http://manned.org/srm|work=srm 1.2.11}}</ref> 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.<ref name="OSX_sunlink"/><ref name="SF_sunlink">{{cite web|title=sunlink function in srm sunlink.c (SourceForge)|accessdate=7 January 2014|author=doj, null_pointer at SourceForge|url=https://srm.cvs.sourceforge.net/viewvc/srm/srm/src/sunlink.c?revision=1.44|format=C Source|publisher=SourceForge.net|work=srm 1.2.11, sunlink.c CVS 1.44|date=24 December 2013}}</ref>
srm 1.2.8 on Mac OS X 10.9<ref name="OSX_src"/> has a <code>-n</code> option, which means "overwrite file, but do not rename or unlink it."<ref name="OSX_man">{{cite web|title=srm - securely remove files or directories|work=srm 1.2.8, OS X Version 10.9|publisher=Apple Inc.|accessdate=7 January 2014|author=doj, null_pointer at SourceForge|location=Man Pages Section 1: Tools|url=https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/srm.1.html|date=20 September 2004}}</ref> However, if the file has multiple links, the multiple-link file data protection feature activates first, removing the file, even though the <code>-n</code> option specifies "do not rename or unlink the file".<ref name="OSX_sunlink"/> The <code>-n</code> 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.<ref name="Unix_man" /><ref name="SF_main">{{cite web|title=srm main.c|accessdate=7 January 2014|author=doj, null_pointer at SourceForge|url=https://srm.cvs.sourceforge.net/viewvc/srm/srm/src/main.c?revision=1.16|format=C Source|publisher=SourceForge.net|work=srm 1.2.11, main.c CVS 1.16|date=9 June 2011}}</ref>
===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.<ref name="SF_TODO">{{cite web|title=srm TODO|accessdate=7 January 2014|author=doj, null_pointer at SourceForge|url=https://srm.cvs.sourceforge.net/viewvc/srm/srm/TODO?revision=1.34|format=Plain Text|publisher=SourceForge.net|work=srm 1.2.11, TODO CVS 1.34|date=24 December 2013}}</ref> On OS X, only the most common non-data fork, the resource fork, is handled in this way.<ref name="OSX_sunlink">{{cite web|title=sunlink function in srm sunlink.c (OS X)|work=Darwin 13.0, OS X Version 10.9: Apple srm 7|publisher=Apple Inc.|accessdate=7 January 2014|author=Apple Inc., Matt Gauthier|url=https://opensource.apple.com/source/srm/srm-7/srm/src/sunlink.c|format=C Source}}</ref> This support was included in Apple’s {{mono|srm}} 1.2.8{{hsp}}<ref name="OSX_src">{{cite web|title=Apple - Open Source|work=Darwin 13.0, OS X Version 10.9|publisher=Apple Inc.|accessdate=7 January 2014|author=Apple Inc.|url=https://www.apple.com/opensource/}}</ref><ref name="SF_README_OSX">{{cite web|title=srm README.OsX (sic)|accessdate=7 January 2014|author=doj, null_pointer at SourceForge|url=https://srm.cvs.sourceforge.net/viewvc/srm/srm/README.OsX?revision=1.2|format=Plain Text|publisher=SourceForge.net|work=srm 1.2.11, README.OsX (sic) CVS 1.2|date=22 November 2010}}</ref> and SourceForge's {{mono|srm}} 1.2.9.<ref name="SF_ChangeLog">{{cite web|title=srm ChangeLog 2008-07-08|accessdate=7 January 2014|author=doj, null_pointer at SourceForge|url=https://srm.cvs.sourceforge.net/viewvc/srm/srm/ChangeLog?revision=1.4|format=Plain Text|publisher=SourceForge.net|work=srm 1.2.11, ChangeLog CVS 1.4|date=25 November 2010}}</ref>
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.<ref name="stackoverflow_removal">{{cite web|title=macbook pro - macOS High Sierra: Where is the Secure Empty Trash option? - Ask Different|accessdate=28 March 2021|url=https://apple.stackexchange.com/q/327239}}</ref>
===OpenBSD=== In srm 1.2.11, released on 25 November 2010,<ref name="SF_files">{{cite web|title=secure rm - Browse files at SourceForge.net|accessdate=7 January 2014|author=doj, null_pointer at SourceForge|url=http://manned.org/srm|publisher=SourceForge.net}}</ref> the OpenBSD rm-compatible option, <code>-P</code>, is documented have an overwriting pattern matching OpenBSD's rm.<ref name="Unix_man"/> Additional functionality which protects multi-linked files is documented under the OpenBSD-compatible option, but is actually always active.<ref name="Unix_man"/><ref name="OSX_sunlink"/><ref name="SF_sunlink"/>
===Windows=== When securely deleting files recursively, srm 1.2.11 is unable to determine device boundaries on Windows. Therefore, the <code>-x</code> option, which restricts srm to one file system, is not supported.<ref name="Unix_man" />
==See also== * {{Annotated link|Data remanence}} * {{Annotated link|List of free and open-source software packages}} * {{Annotated link|rm (Unix)}} * {{Annotated link|shred (Unix)}}
== References == {{Reflist}}
== External links == * [https://srm.sourceforge.net/ Sourceforge Page]
{{Data Erasure}}
Category:Unix file system-related software Category:Unix security-related software Category:Data erasure software