Linux: SFTP and SCP friendly login banners

To display a message when a user logs into your server, add the following to ~/.bashrc:

# If it's an interactive terminal show the banner
if [[ $- == *i* ]]; then
    echo "Welcome to the monitoring server"
    echo "Configuration is stored in /etc/myapp"
fi

This runs only for interactive sessions. Non-interactive connections such as SFTP and SCP remain unaffected, which prevents automated processes from breaking.

Tags:
Leave A Reply
All content licensed under the Creative Commons License