Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I installed Ubuntu 11.10 using the alternative CD and all installed well. For security reasons, I want to be able to wipe the swap of this machine on a regular basis.

I installed secure-delete tools. Now I want to use sswap. But to do so, I need to disable my swap.

How to I go about doing this, and are there any other tips on how to achieve the wiping of the machine's swap of a full encrypted harddisk.

share|improve this question

3 Answers 3

If you don't mind not being able to hibernate then you can just set up encrypted swap and never have to worry about the contents of your swap partition again. Your swap will be encrypted with a key that is randomly generated key on every boot. The key is only held in RAM. Once the power goes, your swap partition will effectively have random garbage that nobody (including you) will be able to decrypt.

The easiest way to enable it is to do:

sudo ecryptfs-setup-swap

See the man page for a little more detail. It is part of the ecryptfs-utils package.

share|improve this answer

Don't you trust the encryption, or why do you want to wipe it?

sudo swapoff 
sudo swapon 

can be used to stop and restart swapping.

You could alternatively boot from a live-CD and use dd to wipe the drive:

sudo dd if=/dev/null of=/dev/YOURSWAPPARTITION

but be careful! Don't forget the partitionnumber, or your whole disc content is lost.

share|improve this answer
    
It's just for extra measure. I might try the live CD way. How would I go about mounting the encrypted filesystem from the live CD, so that I can both use sswap, and that sswap can have access to the swap partition? –  mloman Dec 21 '11 at 17:59
    
First I have to admit, that I don't know sswap. I thought it is a typo, and you meant swap. I don't know how sswap works - swapon/swapoff work with normal swap. For using dd, you wouldn't mount the partition, if it is a whole partition. –  user unknown Dec 21 '11 at 19:53

[This would have been a comment on Hamish Downer's answer, if I had enough reputation]

Warning: The security of a fully-encrypted disk setup is severely compromised by not having an encrypted swap, so you absolutely should use cryptswap to secure your system.

You don't specify which form of full-disk encryption you use. If it is dm-crypt/LUKS via cryptsetup, you can follow the guides in the ArchWiki or Ubuntu community documentation for setting up encrypted swap

  • with a random on-time key similar to the ecryptfs setup described by Hamish Downer (suspend to disk will not work), or
  • with a key stored on your encrypted root partition, so you'll be able to use suspend to disk

Note that wiping the swap partition in any way is unnecessary if it's encrypted.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.