Use the rm command with -P as a shred fallback (#179)
* Use the `rm` command with `-P` as a shred fallback The newer versions of OSX (Sierra) have neither `shred` nor `srm`. They do have `rm` with the `-P` option, so we can fall back to that before resorting to plain old `rm`. * Add double-quotes and braces to the shell variable. We should treat the variable as a string, and we should also be safe when interpolating it.
This commit is contained in:
committed by
Tom Limoncelli
parent
1ce8546efa
commit
bb9f8584c3
@@ -312,6 +312,9 @@ function shred_file() {
|
|||||||
#NOTE: srm by default uses 35-pass Gutmann algorithm
|
#NOTE: srm by default uses 35-pass Gutmann algorithm
|
||||||
CMD=srm
|
CMD=srm
|
||||||
OPT=-f
|
OPT=-f
|
||||||
|
elif _F=$(mktemp); rm -P "${_F}" >/dev/null 2>/dev/null ; then
|
||||||
|
CMD=rm
|
||||||
|
OPT=-Pf
|
||||||
else
|
else
|
||||||
echo "shred_file: WARNING: No secure deletion utility (shred or srm) present; using insecure rm"
|
echo "shred_file: WARNING: No secure deletion utility (shred or srm) present; using insecure rm"
|
||||||
CMD=rm
|
CMD=rm
|
||||||
|
|||||||
Reference in New Issue
Block a user