Forum Moderators: bakedjake

Message Too Old, No Replies

Reformatting hard drive before leaving host

What command do I use?

         

Compworld

4:33 am on Jan 6, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I want to erase my hard drive before I leave my host. What command do I use to do this via ssh?

Compworld

8:12 am on Jan 7, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No one knows?

Frank_Rizzo

9:05 am on Jan 7, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I don't think it would be possible to do via ssh as you would be pulling the rug from under your feet. Probably best just to:

rm * -r -f

your home, log, and etc directories first and then cd / and do the same from there. The OS would probably get about halfway before realising that it's eating itself.

Same applies to any mkfs command I guess.

kullervo

2:41 pm on Jan 7, 2006 (gmt 0)

10+ Year Member



Frank_Rizzo:
First of all, there is a command instead of rm that deletes the file AND cleans out the data on the disc surface where the file was located. I don't know the commands name by heart.

CompWorld:
I've never done this before, but I would unmount the partition and then write random data to it. Something like dd if=/dev/urandom of=/dev/sda1 would probobly do it. I don't know if you need to add some more argument to dd (to tell dd how big the partition is ie.).

The problem is that you cannot unmount root /usr and /var because the system is using them. I would delete all secret files from those partitions and then fill the partitions with random files. Then all the secret data should be overwritten I guess.

I've never done anything like this before, but since you didn't get any other response I wrote this post.

MattyMoose

11:52 pm on Jan 8, 2006 (gmt 0)

10+ Year Member



The trick with This is to not lose your connection to the remote host once the necessary libraries and binaries have been removed...

If this is a hosting company we're talking about, then this may not be possible, if you're not root (and you should check whether you're allowed to do this).

Basically you can run "dd if=/dev/zero of=/dev/hda0" (replace hda0 with whatever your disk's ID is). DO NOT close the connection... You may not get it back... SEe if there's a keepalive option or anything of the like.

encyclo

2:40 am on Jan 9, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The most important thing it to wipe your home directory, which is where your important personal files are stored, then all your database files (if any) as well as all your log files - the rest of the installed OS is less of a problem as there are no secrets in there.

I would use the wipe utility or similar just on /home and /var/log, then once done you can set off a final rm -rf for the rest, and if something is left behind once the connection breaks it would not be a big problem.

Tapolyai

3:15 am on Jan 9, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How are you going to destroy your host's backup tapes?

MattyMoose

5:47 pm on Jan 9, 2006 (gmt 0)

10+ Year Member



How are you going to destroy your host's backup tapes?

With a team of men in black ski masks? LOL

That's a very good point.

I should not though, that as well as that fact, there's also the fact that this box has been insecure from the start, so how could you be certain of anything? I don't think that doing a wipe of any kind will help you in terms of securing any previously written data.

If you truly want to be paranoid in the future, run everything from your own box, with encrypted drives, etc...