Login banner is the message that you see just above the login prompt in the console. You can change the login banner in Linux by editing the /etc/issue file.
The /etc/issue is a text file which contains a message or system identification to be printed before the login prompt.
I want the login message to regenerate each time the system reboots. These are the steps I followed to achieve it.
Open /etc/rc.local file and insert just above the line ...
#File: /etc/rc.local
...
touch /var/lock/subsys/local
... the following code (which is the message I want to show on top of the login prompt) :
echo "Welcome to \n" > /etc/issue
echo "All access to this system is monitored" >> /etc/issue
echo "Unauthorized access is prohibited" >> /etc/issue
echo >> /etc/issue
echo "Last reboot completed at $(/bin/date)" >> /etc/issue
Save and quit the file. That is it. Now each time you reboot, you will get your message shown on the login console.
Explanation
The login task is managed by a daemon called mingetty. Each time the you logout or reboot your machine, mingetty reads the message in the file /etc/issue and displays it just above the login prompt in the console. In the above example, mingetty expands the character '\n' to your machine's hostname.
mingetty recognizes the following escape sequences which might be embedded in the /etc/issue file:
\d - Insert current day (local time)\l - Insert line on which mingetty is running
\m - Machine architecture (uname -m)
\n - Machine's network node hostname (uname -n)
\o - Domain name
\r - Operating system release (uname -r)
\t - Insert current time (local time)
\s - Operating system name
\U - The number of users currently logged in.
\v - Operating system version.
Note: If you have booted into runlevel 5, then press Ctrl-Alt-F1 to view your virtual console.
No comments:
Post a Comment