神刀安全网

Rm does not permanently delete files

rm does not permanently delete files

When using the terminal command rm (or DEL on Windows), files are not actually removed . They can still be recovered in many situations, so I made a tool to truly remove files from your system called skrub.

Rm does not permanently delete files

What is rm actually doing?

When you use the rm command, you are simply unlinking it . This means that the file data is still on your system. Your computer simply removes the filename association to it and “frees” it.

The gotcha about freeing a file is that it remains on your system until your computer needs that memory space. That can be a problem. What happens when you have sensitive data and need it to be removed ?

Rm does not permanently delete files
NEVER try that at home

As you may know from experience, salvaging an rm’d file can be difficult. There are no user-friendly methods for this, yet there are advanced tools that black-hats know how to use like scalpel , magicrescue , and many others.

Skrub your files instead

To remedy this, I have been using skrub, an open-sourced file remover I made. What does skrub do differently? Before removing your files, skrub first floods the file with zero-filled bytes. This means that the memory locations will undergo this process:

Rm does not permanently delete files
File contents before skrubbing (utf-8 view)
Rm does not permanently delete files
File contents after skrubbing (hex view)

Then and only then, is the file removed.

Fancy Features

When building a tool like this, you find alternative options and other implementations. For example, rm has a -P flag for memory flooding. Yet I truly believe that skrub is the easiest to use file remover.

Why Skrub?

  1. Skrub is “-rf” by default. There are no flags needed for daily use:
skrub * == rm -rf *

2. Skrub supports file globbing:

skrub *.js index.html

3. Skrub supports negation in globbing (skrub this but not this ):

skrub *.txt '!importantThing.txt'

Feedback and support for more features appreciated at https://github.com/dawsonbotsford/skrub

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » Rm does not permanently delete files

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址