How to prevent a Linux system user from logging into the system

The shell setting in /etc/passwd determines whether a Linux system user may log in via the shell or over SSH. If you don’t want a certain user to be able to log in, set the shell to /bin/false or /sbin/nologin.

For the user “otheruser” on Debian and Ubuntu Linux, here’s an example:

usermod -s /bin/false otheruser

For Redhat, Fedora or CentOS use /sbin/nologin:

Sponsored
usermod -s /sbin/nologin otheruser

Warning: Do not set the shell for the root user to /bin/false or /sbin/nologin!

The post How to prevent a Linux system user from logging into the system appeared first on FAQforge.

Sponsored
Ubuntu Server Admin

Recent Posts

Ubuntu Weekly Newsletter Issue 873

Welcome to the Ubuntu Weekly Newsletter, Issue 873 for the week of December 29, 2024…

1 day ago

How to resolve WiFi Issues on Ubuntu 24.04

Have WiFi troubles on your Ubuntu 24.04 system? Don’t worry, you’re not alone. WiFi problems…

1 day ago

Remembering and thanking Steve Langasek

The following is a post from Mark Shuttleworth on the Ubuntu Discourse instance. For more…

2 days ago

How to Change Your Prompt in Bash Shell in Ubuntu

I don’t like my prompt, i want to change it. it has my username and…

2 days ago

The Silent Guardian: Why Bundler Checksums Are a Game-Changer for Your Applications

Introduction: A Fragile Trust The Ruby ecosystem relies heavily on RubyGems.org as the central platform…

3 days ago

How to Install Snipe-IT on Ubuntu 24.04

Asset management is the process of managing and maintaining a company’s assets to maximize their…

7 days ago