LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-01-2012, 03:16 PM   #1
shakira19
Member
 
Registered: Sep 2012
Posts: 34

Rep: Reputation: Disabled
remove all


Hi,

I have a ssh access to a machine. I'd like to securely delete everything (system included) from the disk, and then shut this machine down. How could I achieve this ?

Thanks
 
Old 09-01-2012, 03:24 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,341

Rep: Reputation: Disabled
Deleting a running system securely is not as easy as it sounds, remotely or otherwise. If you just rm all the files, sooner or later you'll remove an executable or script needed to shut the system down.

The best way I can think of is to create a custom initrd that overwrites all partitions with zeroes or random data and then shuts the system off. You could then simply add that initrd to the boot loader and reboot.
 
Old 09-01-2012, 04:12 PM   #3
pgrvsunny
LQ Newbie
 
Registered: Sep 2012
Location: Jaipur
Posts: 3

Rep: Reputation: Disabled
simply delete all the parations using fdisk command....specially the partation mounted on / then shutdown the sytem...... it will never reboot untill fresh installation.
 
Old 09-01-2012, 04:24 PM   #4
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,341

Rep: Reputation: Disabled
Quote:
Originally Posted by pgrvsunny View Post
simply delete all the parations using fdisk command....specially the partation mounted on / then shutdown the sytem...... it will never reboot untill fresh installation.
But if you just recreate the partition table with fdisk, the file systems and data will all be there. That doesn't really qualify as "securely deleted".
 
Old 09-01-2012, 04:29 PM   #5
shakira19
Member
 
Registered: Sep 2012
Posts: 34

Original Poster
Rep: Reputation: Disabled
Ser Olmy, could you please give more details as to how to create that custom initrd, and how to add it to the boot loader ?
 
Old 09-01-2012, 04:45 PM   #6
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,341

Rep: Reputation: Disabled
First you'll need to create a regular initrd. If you don't know exactly what that is or how it's created, check the documentation for your distribution (then ask here if something's still not entirely clear).

When you have the initrd, you will need to make the following modifications:
  • add any utilities you need to perform the system erase, like dd, shutdown etc.
  • modify the startup script to run the erase commands instead of actually booting the system
Once this is done, the configuration file of the bootloader (grub or lilo) must be modified to use this initrd. In the case of lilo, the lilo command must be run to update the boot sector.

I would recommend testing this on a virtual machine before deploying, to make sure the target system gets properly erased. Just remember to take a snapshot of the VM before reconfiguring the bootloader; that way you can simply roll back the changes should somthing go wrong.
 
Old 09-01-2012, 04:59 PM   #7
SecretCode
Member
 
Registered: Apr 2011
Location: UK
Distribution: Kubuntu 11.10
Posts: 562

Rep: Reputation: 102Reputation: 102
Is it OK to leave just /bin and /sbin behind? As long as you've got rm, dd and shutdown/poweroff you ought to be able to do this.

(rm every regular file not required to complete the rest of this procedure; dd if=/dev/zero to fill up the drive - on every partition if there is more than one; then poweroff --force. This would need testing on a vm as I suspect some of these commands may result in others being called.)

Why do you need to do this? How securely?
 
Old 09-02-2012, 05:43 AM   #8
pgrvsunny
LQ Newbie
 
Registered: Sep 2012
Location: Jaipur
Posts: 3

Rep: Reputation: Disabled
Ser Omly , if i m not wrong , then after deleting the partition mounted on / for example (/dev/sda1), grub is unable to find the kernel to boot from..... and also if u delete the partition mounted on /home then users personal data is also removed....after the naxt reboot ... grub shell will open up and system won't boot normally ..... i tried it many times on my college pc's...
 
Old 09-02-2012, 09:23 AM   #9
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Quote:
Originally Posted by pgrvsunny View Post
Ser Omly , if i m not wrong , then after deleting the partition mounted on / for example (/dev/sda1), grub is unable to find the kernel to boot from..... and also if u delete the partition mounted on /home then users personal data is also removed....after the naxt reboot ... grub shell will open up and system won't boot normally ..... i tried it many times on my college pc's...
In your example, all you're doing is preventing booting from /dev/sda1, and even then only temporarily. If you boot from a different device like a USB stick, then use a program to scan /dev/sda1 for possible partitions, you could rebuild the sda1 partition table.

Ser Olmy is right, just deleting the partition table doesn't qualify as secure.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
apt-get remove kolf-kde4 will remove kde4? michielv Linux - Software 1 02-10-2009 06:02 AM
Remove Evolution - remove everything?! samjh Debian 4 01-13-2009 06:26 AM
# yum remove dbus - trying to remove the whole system... atnonis Fedora 4 11-23-2007 06:31 AM
apt-get remove chrony doesn't remove all? asgerhallas Debian 3 06-05-2007 05:37 AM
How to - Remove X from already nitrohuffer2001 Linux - Software 2 05-02-2006 12:45 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration