# Ensure /dev/shm is Mounted on a Separate Partition for Secure Shared Memory

- Source: https://support.icompaas.com/support/solutions/articles/62000234966-ensure-dev-shm-is-mounted-on-a-separate-partition-for-secure-shared-memory
- Section: [Solutions](https://support.icompaas.com/support/solutions) › [CIS Amazon Linux 2 Benchmark v3.0.0](https://support.icompaas.com/support/solutions/62000112696) › [CIS Amazon Linux 2 Benchmarks](https://support.icompaas.com/support/solutions/folders/62000169265)
- Last updated: 2026-05-29
- Publisher: iCompaas, Inc. (https://www.icompaas.com)

**Profile Applicability:** • Level 1

**Description:** /dev/shm is a temporary filesystem (tmpfs) that provides shared memory support for processes. Mounting /dev/shm on a separate partition isolates it from the root filesystem, improving security and stability.

**Rationale:** Having /dev/shm on a separate partition limits the risk of denial-of-service attacks that fill shared memory, prevents interference with other filesystem operations, and allows applying mount options such as nodev, nosuid, and noexec to enhance security.

**Impact:** Pros:

-   Isolates shared memory filesystem from root partition.  
    
-   Enables application of stricter mount options to prevent device files, setuid binaries, or execution in shared memory.  
    
-   Helps protect against attacks targeting shared memory.  
    

Cons:

-   Requires additional configuration and partitioning.  
    
-   Misconfiguration could affect system or application stability.  
    

**Default Value:** On many systems, /dev/shm is mounted as a tmpfs but not necessarily as a separate partition.

**Pre-requisites:**

-   Root or sudo privileges to modify /etc/fstab and remount filesystems.
    

**Remediation:**

### **Test Plan:**

**Using Linux command line:**

1.  Check current mount points for /dev/shm:  
    
     mount | grep /dev/shm
    
2.  Verify /dev/shm is mounted on a separate partition or tmpfs:  
    
     findmnt /dev/shm
    
3.  Check /etc/fstab for /dev/shm entry:  
    
     grep /dev/shm /etc/fstab
    
    Expected output: /dev/shm should be listed as a separate mount with appropriate options.
    

  

### **Implementation Plan:**

**Using Linux command line:**

1.  Add or edit /etc/fstab to mount /dev/shm as a tmpfs with secure options, for example:  
    
    tmpfs  /dev/shm  tmpfs  defaults,nodev,nosuid,noexec  0  0
    
2.  Remount /dev/shm without reboot:  
    
     mount -o remount /dev/shm
    
3.  Verify mount options:  
    
     mount | grep /dev/shm
    

### **Backout Plan:**

**Using Linux command line:**

1.  Remove or comment out /dev/shm entry in /etc/fstab.  
    
2.  Remount /dev/shm:  
    
     mount -o remount /dev/shm
    
      
    
3.  Verify /dev/shm mount status.
    

**References:**

-   CIS Amazon Linux 2 Benchmark v3.0.0  
    
-   [NIST SP 800-53 Revision 5 - SC-7  
    ](https://csrc.nist.gov/publications/detail/sp/800-53/rev-5/final#sc-7)

## Related compliance guidance

- [SOC 2 compliance: a practical implementation guide for cloud-native SaaS teams](https://support.icompaas.com/compliance/soc-2-trust-services-criteria): Configuration checks like this one are the technical half of a SOC 2 / ISO 27001 programme — the guide shows where they fit, what else an auditor expects, and how to evidence them.
- [ISO/IEC 27001:2022 compliance: a practical implementation guide](https://support.icompaas.com/compliance/iso-27001-2022): ISO 27001 Annex A.8 (technological controls) is where cloud hardening evidence lands; the guide shows how to run the ISMS around it.
