Liangxu Linux
Liangxu Linux
Jan 2, 2025 · Information Security

How to Block SSH Logins for Specific Users, Groups, and IP Ranges on Linux

This guide explains multiple Linux techniques—setting a user’s shell to /sbin/nologin, editing /etc/passwd, configuring sshd_config with Allow/Deny directives, and using hosts.allow/hosts.deny—to prevent unwanted SSH access for particular users, groups, or IP addresses, and shows how to apply the changes safely.

LinuxSSHhosts.allow
0 likes · 11 min read
How to Block SSH Logins for Specific Users, Groups, and IP Ranges on Linux
Liangxu Linux
Liangxu Linux
Jun 29, 2024 · Information Security

How to Block SSH Logins for Specific Users, Groups, and IPs on Linux

This guide explains multiple Linux techniques—including nologin shells, sshd_config allow/deny lists, and hosts.allow/hosts.deny rules—to prevent selected users, groups, or IP addresses from logging in via SSH, with practical commands, examples, and a ready‑to‑run script.

LinuxSSHSecurity
0 likes · 11 min read
How to Block SSH Logins for Specific Users, Groups, and IPs on Linux
Liangxu Linux
Liangxu Linux
Oct 7, 2021 · Operations

Disable Shell Login for Linux Users: Create and Modify Accounts

This guide explains how to prevent Linux users from obtaining a shell login by using the /sbin/nologin shell, covering both creation of new accounts with restricted shells and modification of existing accounts via chsh or usermod, including command syntax and practical examples.

Linuxnologin
0 likes · 4 min read
Disable Shell Login for Linux Users: Create and Modify Accounts
Open Source Linux
Open Source Linux
Sep 4, 2021 · Operations

How to Use nologin to Block User Logins on Linux

This guide explains how the Linux nologin command can politely deny user logins, log attempts, and provides multiple methods—including command-line usage, password locking, and /etc/passwd modifications—to restrict login access for specific or all users during system maintenance.

LinuxSystem Administrationnologin
0 likes · 3 min read
How to Use nologin to Block User Logins on Linux