How to customize the login message on Ubuntu 14.04.3 LTS
Solution 1:
To customize the pre-login message, such as to create a login banner, you need to edit /etc/issue
file.
To customize post-login messages, you can edit some of the files in /etc/update-motd.d
. Such files as 00-header
and 10-help-text
in that directory are safe to edit.
Another possibility is to add a custom function/command to your .bashrc
at the end of the file.
For instance, I have the following function defined at the top of my .mkshrc
file :
testTTY(){
isTTY=$(tty | awk '{if ($0~/\/dev\/tty.*/) {print "true"}else{print "false"}}')
if [ "$isTTY" = "true" ]; then
printf "You are in virtual console\n"
printf "current disk usage is"
df
fi
}
And I call the function at the end of .bashrc
with just testTTY
. As you can see from the code, the function determines if I logged in into TTY or not, and if it is TTY, it shows appropriate message and output of df
command
Solution 2:
The configuration files are in /etc/update-motd.d
. motd
stands for the message of the day.