My Oracle Support Banner

Oracle Linux: How to Restrict SSH Access to Specific or All Users (Doc ID 1614856.1)

Last updated on FEBRUARY 12, 2023

Applies to:

Linux OS - Version Oracle Linux 6.0 and later
Oracle Cloud Infrastructure - Version N/A and later
Linux x86-64
Linux x86


By default, an Oracle Linux (OL) system permits SSH login to all configured users.
For security or other reasons, permanently or temporarily restricting SSH access to some or all users may be necessary.
This document describes various methods to restrict SSH access to some or all users.


To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!

In this Document
 1. Restricting specific user access via /etc/ssh/sshd_config: AllowUsers
 2. Restricting all user access except root using pam_nologin
 3. Restricting specific user access via pam_listfile

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.