Login email alert

A simple one-liner that can be added to the global bashrc (/etc/bash.bashrc on Ubuntu) to send an alert via email when a user logs in. Useful for login alert from un-attended machines you don’t usually log into.

echo 'Login on' `hostname` `date` `who` | mail -s "Login on `hostname` `who | awk '{ print $5 }'`" [email protected]

SSH port forwarding

ssh -L localport:host:hostport [email protected]_server -N


ssh -L 8888:www.google.com:80 [email protected]_server -N

Browsing to http://localhost:8888/ would tunnel all requests to google via your SSH server’s IP address.