Appendix C. Advanced: Off-site Email Using SSH

Table of Contents
Forwarding ports
Configuring your email client
Disconnecting the tunnel

The ability to use email from an off-site location, while using your Truman email address, may be somewhat difficult to accomplish if your ISP does not allow email relaying. If you have had trouble setting up email for your Truman account using your ISP's SMTP server, one solution may be to tunnel your email data into the Truman network using SSH and use their mail servers. The script shown below is one that I wrote which allows me to use email from my home over CableONE's cable internet service.

Forwarding ports

Example C-1.


# Set up a tunnel
ssh \ \ \
 'sleep 30;exit' &

# Run your favorite email client
evolution &

This script does two things. The first is that it forwards two ports on the local computer via xenon to two computers on the Truman network. The second is that it starts an email client to use those ports.

The -L option determines the port forwarding. The ports that are forwarded are:

Anytime a computer program tries to connect to port 8143 or 8025 on your computer, that data will be forwarded via the ssh tunnel to the appropriate computers on the Truman network.

One neat feature of ssh is that it allows the connection to stay open as long as an application is using the port forwarding, even if the interactive terminal session is over. So, when the script automatically runs the exit command after 30 seconds, the terminal session is over, but I can still transmit and receive data over the forwarded ports.