#!/bin/bash mydir=$(dirname "$0") sudo "$mydir/send_login_alert.sh" shell=$(getent passwd $LOGNAME | cut -d: -f7) if [ "$SSH_ORIGINAL_COMMAND" = "internal-sftp" ] # command given, so run it then exec /usr/lib/ssh/sftp-server elif [[ -n $SSH_ORIGINAL_COMMAND ]]; then exec "$shell" -c "$SSH_ORIGINAL_COMMAND" else # no command, so interactive login shell exec "$shell" -il fi