Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The method of modifying the Welcome message of Linux remote login

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the method of modifying the welcome message of Linux remote login, which is very detailed and has certain reference value. Friends who are interested must finish reading it!

Whenever you log in to some of the company's production systems, you will see login messages, warnings, or information about the server you will log in or have logged in, as shown below. These are the login guides login banner.

In this article, we will teach you how to configure them.

You can configure two types of prompts.

The prompt displayed by the user before login (configured in the file of your choice, for example / etc/login.warn)

The prompt message displayed after the user successfully logs in (configured in / etc/motd)

How to display a message when a user connects to the system before logging in

This message will be displayed to the user when he connects to the server and before logging in. This means that when he enters a user name, the message will be displayed before the password prompt.

You can use any file name and enter information in it. Here we use / etc/login.warn and put our messages in it.

# cat / etc/login.warn! Welcome to KernelTalks test server! This server is meant for testing Linux commands and tools. If you arenot associated with kerneltalks.com and not authorized please dis-connectimmediately.

Now you need to tell the sshd daemon this file and path so that it can get this banner for each user login request. For this, open the / etc/sshd/sshd_config file and search for # Banner none.

Here you need to edit the configuration file and write down your file name and delete the comment mark (#).

Banner / etc/login.warn

Save the file and restart the sshd daemon. To avoid disconnecting existing users, restart sshd using the HUP signal.

Root@kerneltalks # ps-ef | grep-I sshdroot 14255 1 0 18:42? 00:00:00 / usr/sbin/sshd-Droot 19074 14255 0 18:46? 00:00:00 sshd: ec2-user [priv] root 19177 19127 0 18:54 pts/0 00:00:00 grep-I sshdroot@kerneltalks # kill-HUP 14255

That's it! Open a new session and try to log in. You will look at the messages you configured in the above steps.

You can see this message before the user enters the password to log in to the system.

How to display a message after a user logs in

The message of the day Message Of The Day (MOTD) that the message user sees after successfully logging in to the system is controlled by / etc/motd. Edit this file and enter a message to welcome the user after a successful login.

Root@kerneltalks # cat / etc/motd W E L C O M EWelcome to the testing environment of kerneltalks.Feel free to use this system for testing your Linuxskills. In case of any issues reach out to admin atinfo@kerneltalks.com. Thank you.

You do not need to restart the sshd daemon for the changes to take effect. As long as the file is saved, the sshd daemon will read and display on the next login request.

You can see in the screenshot above: the yellow box is the MOTD controlled by / etc/motd, and the green box is the login guide we saw earlier.

You can use cowsay, banner, figlet, lolcat and other tools to create excellent and compelling login messages. This method applies to almost all Linux distributions, such as RedHat, CentOs, Ubuntu, Fedora, and so on.

The above is all the contents of this article entitled "how to modify the Welcome message for Linux remote login". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report