How to display a message before login?

16

3

I need to display a message before any login on a Linux box, either locally and for remote login via SSH.

How can I achieve this?

Edit:

Thanks for your answers. I had to pick one accepted answer, but both are correct and complement each other.

"issue" and "Banner" are the two concepts I need to use to provide a message for every user before they log into the system.

ascobol

Posted 2011-05-29T19:07:34.977

Reputation: 799

Answers

16

For local login (or telnet) you need to modify:

/etc/motd

For display a message before login you edit instead

/etc/issue

see http://www.cyberciti.biz/faq/howto-change-login-message/

DrNoone

Posted 2011-05-29T19:07:34.977

Reputation: 1 267

2+1 (motd being the abbreviation of "message of the day"). – Alain Pannetier – 2011-05-30T00:16:08.397

is the motd displayed before the user is asked for a password ? – ascobol – 2011-06-02T11:18:58.873

The contents of /etc/motd are displayed by login(1) after a successful login but just before it executes the login shell. – DrNoone – 2011-06-02T19:45:50.063

12

For SSH, you need to change the Banner config option in sshd_config:

http://www.cyberciti.biz/tips/change-openssh-sshd-server-login-banner.html

Sophie Alpert

Posted 2011-05-29T19:07:34.977

Reputation: 1 057

1sure, but that will only display a message after a login name was given through ssh-connection. Any ideas displaying a banner / message before 'login: ' ? – Master of Celebration – 2013-08-01T09:31:06.337