I've run into an issue trying to set up a little bit of ASCII art to display upon connection and on logout.

I can do this for one user with .bashrc and with .bash_logout, and set a login MOTD by creating /etc/profile.d/motd.sh, but haven't found a way to set a universal logout MOTD. How can I do this?

I am running CentOS 6.

  • 2
    It isn't clear what you're asking. motd is a message ("message of the day", thus motd), that is used for announces such as "This machine will be down for scheduled maintenance on Friday between 12:00 and 14:00". .bash_logout is a script. You can set a .bash_logout script for new users by adding it to /etc/skel, and you can add commands to .bash_logout for existing users with a script. But (1) it's pointless to print messages from .bash_logout (since the shell is going away...), and .bash_logout only applies to people who has bash as their shell. – lcd047 Jun 8 '15 at 15:37

From the manual (man bash):

When a login shell exits, bash reads and executes commands from the files ~/.bash_logout and /etc/bash.bash_logout, if the files exists.

There is another answer on U&L SE on login messages.

| improve this answer | |
  • 2
    Only if #define SYS_BASH_LOGOUT is uncommented in config-top.h when building bash. it is commented out by default and not many packagers enable it either. – llua Jun 8 '15 at 17:34
  • bash on CentOS 7 has it enabled. – jnas Sep 19 '16 at 7:54
  • Works fine for me using Ubuntu 16.04 LTS. – CyberFonic Apr 4 '17 at 8:53

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.