Give Your Users a Warm Welcome Message
It's easy to show a welcome message to users after login in Linux. All you have to is edit the "/etc/motd" file and that's it.
/etc/motd File
As name suggests, to show a "Message of the Day" in Linux, you can use /etc/motd
file. By default, this file is empty.
You can simply "echo" anything in the file or use your favorite text editor to put some message inside. After you edit the file, all users will see the message you wrote after successfully login. See the example below:
ali@zion:~$ ssh root@192.168.0.21
root@192.168.0.21's password:
Last login: Sat May 14 12:15:08 2022
_
( `.
,.--. '. \
// \ \ \
\\ / \ \
`'--' ' .
,.--. | |
// \ ' '
\\ / / /
`'--' / /
.' /
(_.'
Roses are red
Violets are blue
Here's a welcome message
Cuz I care about you!
/etc/issue and /etc/issue.net Files
/etc/motd
file shows the message "after user logged in." If you want to show a message to users prior to login, you can achieve this by editing /etc/issue
and /etc/issue.net
files.
ali@zion:~$ getroot
#=============================================================#
# #
# Those who can imagine anything, can create the impossible. #
# - Alan TURING #
# #
#=============================================================#
Now, if you're not me, get the fuck out of my system.
That was my last chance.
Last login: Sat May 14 12:18:47 2022 from 0.0.0.0
The Difference Between /etc/issue and /etc/issue.net
You can split pre-login messages in two categories: local logins and remote logins. /etc/issue
file is used for local logins. /etc/issue.net
file on the other hand, used for remote logins like SSH. In the example above, a message is showed to user who tries to SSH to remote server.