Other Articles

Servers – Verify SSH MaxSessions Configuration

Secure Configuration Checks > Server

This check ensures that SSH MaxSessions is configured to limit the number of concurrent sessions per connection.

Improper configuration can allow excessive concurrent sessions, which may lead to denial-of-service conditions or resource exhaustion. Limiting MaxSessions helps maintain system availability and secure SSH access.

Check Details

  • Resource: Server
  • Check: Ensure SSH MaxSessions is set to 4 or less
  • Risk: High number of concurrent sessions can lead to resource exhaustion and potential denial-of-service attacks.

Remediation Steps

  1. Open a terminal session with root or sudo privileges.
  2. Verify current MaxSessions configuration:

    sshd -T | grep -i maxsessions
    
  3. Ensure the output shows MaxSessions set to 4 or less.
  4. Edit SSH configuration file:

    sudo nano /etc/ssh/sshd_config
    
  5. Add or modify the MaxSessions parameter:

    MaxSessions 4
    
  6. Save the file and exit.
  7. Restart SSH service:

    sudo systemctl restart sshd
    
  8. Re-run the audit command to confirm the configuration.
  9. Regularly review SSH settings to ensure compliance with security policies.

Updated on 06 March, 2026