• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

AI, Linux, Cloud and DevOps

  • Home
  • Resources
    • Learn Linux
    • Articles
  • My Projects & Work
    • My Nagios Plugin
    • My Dockerhub Repo
    • My WordPress plugins
    • My Github Repos
  • Facebook Page
  • Contact
  • Privacy Policy
  • About Me
You are here: Home / Articles / How to customize nologin shell message

How to customize nologin shell message

May 23, 2011 by Sharad Chhetri Leave a Comment

In this post we will learn how to customize the nologin shell message for user on linux/unix system. This is very useful when you want to display your company strict legal security message to users who are trying to login into your servers. As we know that , nologin shell won’t allow user to login and shows a message to user on terminal.

Now lets start making our customize nologin message for users.

Set nologin shell

For setting the user in nologin shell you can use either of given below command.

usermod -s /sbin/nologin user_name

OR

chsh -s /sbin/nologin user_name

When you do ‘su -l user_name‘ after changing the user bash shell to nologin shell, by default you will get the message “This account is currently not available ” .

Customize nologin shell message

Step 1: Create a user and change to nologin shell

We have created a user called test. And changed its shell to nologinshell. As expected, we will get the by default message as given below –

[root@localhost /]# grep test /etc/passwd
test:x:500:500::/home/test:/sbin/nologin
[root@localhost /]# su -l test
This account is currently not available.
[root@localhost /]#

Step 2: Write custom message in /etc/nologin.txt file

Now for changing the nologin message, create a new file called nologin.txt in /etc . Write your customized message in /etc/nologin.txt file.

## Using vi editor for editing

vi /etc/nologin.txt
## Writing custom message in file
Your account is disabled because of security breach.
contact to-
Linux System Administrator
sharadchhetri.com
extension: +747

Step 3: Verify custom nologin message

Now verify the nolgin customize message if it works.

[root@localhost /]#
[root@localhost /]# su -l test
Your account is disabled because of security breach.
contact to-
Linux System Administrator
sharadchhetri.com
extension: +747
[root@localhost /]#

Note: To revert back to old message settings, just remove the /etc/nologin.txt file (sudo rm /etc/nologin.txt).

Yes it is working now .And this message will be applicable to all account which has nologin shell.

Share this:

  • Share on X (Opens in new window) X
  • Share on Facebook (Opens in new window) Facebook
  • More
  • Print (Opens in new window) Print
  • Email a link to a friend (Opens in new window) Email
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Reddit (Opens in new window) Reddit
  • Share on Tumblr (Opens in new window) Tumblr
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on Telegram (Opens in new window) Telegram
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Mastodon (Opens in new window) Mastodon

Articles

Root Is Not Able To Login In Red Hat And CentOS
create and delete user in Red Hat and CentOS
How to create own Git Server with Gitolite and Gitweb in Ubuntu
How to configure vsftpd server with virtual user mysql authentication in CentOS 6
How to install and configure FTP server in Ubuntu 12.04 LTS
Setup Master Slave Chroot BIND DNS in CentOS 6 or Red Hat 6
How to delete password of user in Linux
Find installed and enabled apache module in Debian/Ubuntu
Linux: Temporarily change the shell after login
How to lock and unlock user account in linux
Learn tar command and know about its precaution
How to configure multiple mysql instance in Ubuntu
RSA key authentication in Linux : Passwordless login
list files and directories by 4 commands in linux
Essential Linux Commands Every Beginner Should Know | With Examples

Filed Under: Articles Tagged With: linux, nologin

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Articles

  • Install n8n docker in Ubuntu for practicing
  • Bash Script: MySQL Database backup to AWS S3
  • Automate no touch Jenkins setup wizard on docker (jcac)
  • How to run and configure Jenkins in Docker container
  • Complete Guide: How to install Nagios Monitoring on AlmaLinux / Rocky Linux
  • Install KVM on Ubuntu 24.04 LTS ( Bash Script )
  • How to install GIMP 2.10 on Ubuntu / Debian
  • 5 ways to check Ubuntu version of system (commands and GUI)
  • How To Solve Forgot MySQL / MariaDB Root Password
  • Create Self Hosted Build Agent Docker Image for Azure DevOps

Copyright © 2026 ยท
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From India.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy