Secure Erase Swap Partition

Source: Internet
Author: User

We know that the security problems are becoming more and more serious, and there are many information leakage problems in some places. For example, a swap partition. The swap partition frees up some of the space in the hard disk space when the system's physical memory is not available for use by the currently running program. The freed space may come from programs that have not been manipulated for a long time, and the freed space is temporarily saved to the swap partition until those programs are run and the saved data is restored to memory from the swap partition. That is, the swap partition is a swap area that is swapped with the physical memory when it is not enough (not in all cases, of course).
Then, it is necessary to safely erase (release) the swap partition when the computer is turned on, to ensure that the memory that is swapped out by the application is completely erased when it is rebooted.
Our release of the swap space is actually done by closing the swap partition and then restarting the swap partition.
We can begin by following a few commands to achieve our goal:
Free-m
Swapoff-a
Free-m
Swapon-a
Free-m
First, the first free-m command can be used to see the swap usage and distribution, and then swapoff-a close the swap partition, then view the partition, swapon-a open the swap partition, free-m before the comparison.

If a swap partition is used, the result of the first free-m and the third free-m should be different. In addition, these two commands of swap must be executed under root authority.
Next, we only use the set power on automatically execute swapoff-a and swapon-a two command on line
The

Under root permissions to/ETC/RC.D to see if there is no rc.local file, if there is a direct swapoff-a and swapon-a the two commands added to the line, if you do not have this file to build one, and then in the form of shell script to write these two commands in.
OK, so that we can safely erase (release) the swap partition at boot time, ensuring that the memory that is swapped out by the application is completely erased at boot time.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.