Normally it would be a good idea to do that via PAM, but you're on a router...
You could put something like
echo 'Root Shell Access | mail -s "Root Shell Access" [email protected]
/etc/profile, but then again that would fire every time you access your routers shell.
Better yet, modify or create /etc/ssh/sshrc with the following contents:
ip=`echo $SSH_CONNECTION | cut -d " " -f 1`
logger -t ssh-wrapper $USER login from $ip
echo "User $USER just logged in from $ip" | sendemail -q -u "SSH Login" -f "Originator <[email protected]>" -t "Your Name <[email protected]>" -s smtp.server.com &
This will effectively notify you by email anytime someone logs in through SSH, and the login will be logged in the syslog.
Note: You'll need the `sendemail` package for the email notification to work.
Note: works with port forwarding, but with -N option not.