When you connect to your Linux server via SSH, you might see various welcome messages and system information that clutter your terminal. This guide shows you how to clean up your SSH login experience by removing these messages.
What You’ll Remove
By following this guide, you’ll disable:
- Last login timestamps
- System information (kernel version, distribution details)
- Message of the Day (MOTD)
- Welcome banners
Step 1: Edit SSH Configuration
Open the SSH configuration file with your preferred text editor:
sudo nano /etc/ssh/sshd_config
Add or modify these lines in the file:
PrintLastLog no
PrintMotd no
Banner none
Step 2: Disable Message of the Day
The MOTD displays system information when you log in. To disable it:
# Clear the existing MOTD
sudo truncate -s 0 /etc/motd
# Disable MOTD scripts
sudo chmod -x /etc/update-motd.d/*
Step 3: Disable Last Login via PAM
If the „Last login“ message still appears, disable it through PAM (Pluggable Authentication Modules):
sudo nano /etc/pam.d/sshd
Find this line and comment it out by adding a #
at the beginning:
# session optional pam_lastlog.so
Step 4: Restart SSH Service
Apply your changes by restarting the SSH service:
sudo systemctl restart sshd
Or on older systems:
sudo service ssh restart
Step 5: Test Your Changes
Log out and log back in to see your clean terminal. You should now see only your command prompt without any system messages.
Troubleshooting
Still seeing messages? Try these additional steps:
- Check if settings are applied:
grep -i "PrintLastLog\|PrintMotd" /etc/ssh/sshd_config
- For Tailscale SSH users: The above methods should work, but if you’re still seeing messages, they might be coming from your shell profile.
- Verify SSH service restarted:
sudo systemctl status sshd
Security Note
Disabling login messages doesn’t affect your server’s security. These messages are purely informational and removing them creates a cleaner login experience while maintaining all security features.
Reverting Changes
To restore the original login messages:
- Remove or comment out the lines you added in
/etc/ssh/sshd_config
- Restore MOTD scripts:
sudo chmod +x /etc/update-motd.d/*
- Uncomment the PAM lastlog line in
/etc/pam.d/sshd
- Restart SSH:
sudo systemctl restart sshd
Your SSH login will now be clean and minimal, showing only what you need to get to work.