About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
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.
[{"Product":{"code":"SWG10","label":"AIX"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Component":"Not Applicable","Platform":[{"code":"PF002","label":"AIX"}],"Version":"5.3;6.1","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]
Was this topic helpful?
Document Information
Modified date:
17 June 2018
UID
isg3T1011768
Manage My Notification Subscriptions