Question & Answer
Question
How can I add a message to ssh that users will see when they log in?
Answer
The OpenSSH SSH daemon /usr/sbin/sshd can be modified to present a custom banner ( or herald ) to the user when he or she logs in. This banner will be present if using either shared key login or normal password-prompted login.
First, create a banner file that will be printed when a user logs in via ssh. A good place to keep this file is in the ssh configuration directory /etc/ssh
# cd /etc/ssh
# vi mybanner
Add whatever text you wish:
This is the ssh banner
Next, edit the sshd configuration file /etc/ssh/sshd_config and uncomment this entry, pointing it to the path of the file you just created:
# no default banner path
#Banner none
Banner /etc/ssh/mybanner
Then stop and restart sshd to have it re-read the configuration file and use the banner:
# stopsrc -s sshd
0513-044 The sshd Subsystem was requested to stop.
# startsrc -s sshd
0513-059 The sshd Subsystem has been started. Subsystem PID is 225440.
The next time a user connects via ssh they will see the banner:
$ ssh puma
This is the ssh banner
bob@puma's password:
For users with shared keys it will look like:
$ ssh puma
This is the ssh banner
NOTE:
sshd does not use the herald information from the /etc/security/login.cfg configuration file. This is only used by native AIX programs.
Was this topic helpful?
Document Information
Modified date:
17 June 2018
UID
isg3T1011768