Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for a command similar to wall but will deliver a message to users currently sshed in and if they are not logged in will display upon their next ssh login( but only once ). Context is that I may( not guaranteed ) have a network outage but not everyone on the machine(s) will have gotten the maintenance email and I would rather forward the email to all the users of the machine(s). Not looking to put a message in /etc/motd since that will put up the message upon every login.

share|improve this question
What is the problem with getting this message multiple times upon login? Just remove it after the outage is done or definitely not necessary. – Sven Mar 14 '13 at 12:30
It's annoying to get spammed with countless messages when it's always the same thing, I guess that's the only reason. – gparent Mar 14 '13 at 16:03
That is pretty much the reason, I know I open up two or three shell sessions and quite a number of users login on somewhat spotty internet connections so getting hit with the same message a couple dozen times a day gets irritating quickly. – VincentAlpha Mar 14 '13 at 17:41
up vote 3 down vote accepted

There's a standard way of doing this: news. In olden times this was a standard command, but these days it's a bit crusty and has to be installed manually. The Debian/Ubuntu package you want is sysnews.

To use it,

  • create a file called something like /var/lib/sysnews/login-message containing your message
  • add news to /etc/profile (or equivalent for your users' shell)

When your users log in, they'll see the message the first time, but then .news_time is created in their home directory, and they'll only see news items that have been modified since the timestamp of that file.

share|improve this answer
Sounds like exactly what I am looking for, just need to find a package for CentOS then. Cheers! – VincentAlpha Mar 14 '13 at 17:44

Do you have a global /etc/profile that you could do this from? Won't catch everyone and their weird shell of the day, but basically

if [ ! -e "$HOME/.saw-the-message" ];
   echo "The system will go down tomorrow, but I will never tell you again!"
   touch $HOME/.saw-the-message


  • you'll have to clean up the lock files afterwards
  • misses some people who use $weird_shell
share|improve this answer
Dont you mean if [ ! -e "$HOME/.saw-the-message" ]; ? – user160910 Mar 14 '13 at 13:01
Erm, I do. Thanks. – themel Mar 14 '13 at 16:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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