0

I would like to clear my swap on shutdown because I heard that swap does not get cleared like ram and any personal information on it could be preserved. I don't want to encrypt the swap as I had previous issues with that.

I know sudo swapoff -a && sudo swapon -a will clear the swap, but how can I get my PC to execute that on shutdown, is there some sort of script I can add this to? Or am I terribly mistaken and swap DOES get cleared?

Braiam
  • 67,791
  • 32
  • 179
  • 269
  • Does this answer you question https://askubuntu.com/a/796157/8698 about running scripts on shutdown? – Dan Jul 22 '20 at 14:48
  • You could also simply turn off swap when using applications that handle personal data like browsers and email. Or change the nice level so those personal-data applications are less likely use swap than your massive protein-folding application. – user535733 Jul 22 '20 at 15:14
  • 2
    This (clearing swap) is not worth doing unless you have a good Threat/Risk model, and have searched online for "recovering data from swap" – waltinator Jul 22 '20 at 16:39
  • Thanks guys but recently I moved to Manjaro and encrypted the entire drive with LUKS so the encrypted swap is not an issue anymore. But thank you for your help! – corrupt_disk1 Aug 01 '20 at 16:06

0 Answers0