# Ensure Actions as Another User Are Always Logged (Automated)

- Source: https://support.icompaas.com/support/solutions/articles/62000235494-ensure-actions-as-another-user-are-always-logged-automated-
- 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 2

### **Description:**

The audit system should log all instances where users perform actions as another user, such as using `sudo` or `su` commands. Capturing these events provides accountability and helps detect unauthorized privilege escalations or misuse of elevated access.

### **Rationale:**

Logging actions performed as another user supports security monitoring, forensic investigations, and compliance requirements. Without such logs, it becomes difficult to track who performed critical administrative actions.

### **Impact:**

**Pros:**  
Improves traceability of privilege escalation activities  
Supports incident response and auditing  
Enhances compliance with security policies

**Cons:**  
Generates additional audit records requiring review and storage

### **Default Value:**

Audit rules for `sudo` or `su` commands are not always present by default.

### **Pre-requisites:**

-   `auditd` installed and running
    
-   Root or `sudo` privileges to add audit rules
    

### **Test Plan:**

**Using Linux Command Line:**

1.  Check existing audit rules for `sudo` and `su` commands:
    
    auditctl -l | grep -E 'sudo|su'
    
2.  Review audit rules configuration files:
    
    grep -E 'sudo|su' /etc/audit/rules.d/\*
    

### **Implementation Plan:**

**Using Linux Command Line:**

1.  Add audit rules to monitor execution of `sudo` and `su`:
    
    auditctl -w /usr/bin/sudo -p x -k actions\_as\_another\_user
    auditctl -w /usr/bin/su -p x -k actions\_as\_another\_user
    
2.  To make these rules persistent, add the following lines to `/etc/audit/rules.d/audit.rules`:
    
    \-w /usr/bin/sudo -p x -k actions\_as\_another\_user
    -w /usr/bin/su -p x -k actions\_as\_another\_user
    
3.  Restart auditd service:
    
    systemctl restart auditd
    

### **Backout Plan:**

**Using Linux Command Line:**

1.  Remove the audit rules monitoring `sudo` and `su`:
    
    auditctl -W /usr/bin/sudo -p x -k actions\_as\_another\_user
    auditctl -W /usr/bin/su -p x -k actions\_as\_another\_user
    
2.  Remove the lines from `/etc/audit/rules.d/audit.rules`
    
3.  Restart auditd service:
    
    systemctl restart auditd
    

### **References:**

CIS Amazon Linux 2 Benchmark v3.0.0  
Auditd Rule Documentation  
NIST SP 800-53 Revision 5 - AU-6

###

## 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.
