Change the system login banner in Linux

October 01, 2005
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.

Regenerate the login message each time the system reboots


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 you 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.

Escape sequences you can use in your /etc/issue file


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.

If you have booted directly into GUI mode,
you can press Ctrl + Alt + F1 to view your virtual console.

0 comments: