21

How to customize the login message on Ubuntu 14.04.3 LTS?

I want to customize the below login message.Please let me know which file do I need to edit.

root@10.1.235.227's password:
Welcome to Ubuntu 14.04.3 LTS (GNU/Linux 3.19.0-25-generic x86_64)

 * Documentation:  https://help.ubuntu.com/

  System information as of Wed Oct 14 01:05:33 CDT 2015

  System load:    0.0             Processes:           117
  Usage of /home: 0.1% of 944MB   Users logged in:     1
  Memory usage:   4%              IP address for eth0: 10.1.235.227
  Swap usage:     0%

  Graph this data and manage this system at:
    https://landscape.canonical.com/

0 packages can be updated.
0 updates are security updates.


Last login: Wed Oct 14 01:05:35 2015 from 172.20.20.98
25

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 dfcommand

4

The configuration files are in /etc/update-motd.d. motd stands for the message of the day.

2
  • Hello I want to remove these lines from login prompt and make my own customized message – Nidhi Oct 14 '15 at 7:03
  • Try to change the files and see what happens. For instance add a line 'printf "My custom message"' at the end of 00-header file. Take a look at printf lines and change them as you wish. – nobody Oct 14 '15 at 7:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.