pam_motd

最後更新: 2023-05-03

介紹

After a successful login, by default the /etc/motd file is shown.

The message size is limited to 64KB

 


pam_motd.so - Display the motd file

 

Usage

pam_motd.so [motd=/path/filename]                  # Default: /etc/motd

Debiang / Ubuntu

* Run the scripts from /etc/update-motd.d to update the motd on login

i.e.

# A static (admin-editable) motd

session    optional     pam_motd.so

# Dynamically generated motd

session    optional     pam_motd.so  motd=/run/motd.dynamic noupdate

noupdate     -      Don't run the scripts in /etc/update-motd.d to refresh the motd file.

 


ssh pam settings

 

motd

它有分 Dynamically / Statically

  • Dynamically generated part from /run/motd.dynamic
  • A statically (admin-editable) part from "/etc/motd"

/etc/pam.d/sshd

session    optional     pam_motd.so  motd=/run/motd.dynamic
session    optional     pam_motd.so  noupdate

P.S. 

By default the /etc/motd file is shown

session  optional  pam_motd.so

相當於

session  optional  pam_motd.so  motd=/etc/motd

Disable motd in pam

sed -i '/^[^#]*\<pam_motd.so\>/s/^/#/' /etc/pam.d/sshd

 


update-motd.d

 

/etc/update-motd.d

  • 00-header
  • 10-help-text
  • 50-motd-news
  • 91-contract-ua-esm-status

 

Creative Commons license icon Creative Commons license icon