Tunneling SSH for POP and SMTP

Hello! Please excuse this questions if they seem basic - I’m a brand-new DreamHost customer.

I’m trying to tunnel SMTP (port 25) and POP (port 110) using SSH (PuTTY) .

  1. I know I SSH to my shell account, but I also know that the mail servers are separate. Therefore, what are the settings in PuTTY for the SSH tunnel?
  2. What do I put as the POP and SMTP servers in my mail client (Outlook)? “localhost” or my mail server?
  3. Any other special port settings?
  4. Can I have more than one PuTTY session active at once in order to tunnel for more than one mailbox at one time? If so, do I specify different server names or are they all “localhost”?

I would very much appreciate some step-by-step instructions from someone who does this and might have a little patience to write it up.

I’ve been blown away by the wealth of information in the wiki and the forums, and it’s been very helpful in getting started. However, I’ve tried and tried and I can’t find the answer to this question as it relates to my particular situation.


Is this kinda what you’re trying to do?


What you’re doing is telling SSH when I connect to this local port, actually connect it to this other location.

The way the tunnel works, you should probably only have one putty running for tunnelling. (considering that only one application can listen on a port, that should make sense).

Let us know if it helps!

Wholly - Use promo code WhollyMindless for full 97$ credit until 12/11/07.

Hey, thanks for the reply.

Yep, I’m trying to perform the port forwarding. I think I figured it out and it’s working now…I’ll find out tomorrow when I’m at work and the SMTP port is blocked.

I was unclear which settings to put into PuTTY and then into Outlook. It seems to work using (1) localhost as the mail server in Outlook, (2) the following settings in PuTTY to forward ports 25 and 110:

Source port: 25; Destination: [mailserver]:25
Source port: 25; Destination: [mailserver]:25

As long as the mailboxes are all on that mail server, it appears to work.

Now I need to figure out how to do a concurrent SSH session to ANOTHER mail server for another mail account. I probably have to specify it as something other than “localhost”, but I don’t know how to do that. Also, for that other mail account I don’t know whether I can still use the standard ports for those or I have to use something else.

Any insight is appreciated! Thanks.

Easy solution, just use a different port.

Set up this way:

localhost:25 mail.myfirst.com:25
localhost:26 mail.mysecond.com:25

Just because outlook talks on a port doesn’t mean it has to go to that port at the other end of the tunnel.

You may want to use port 587 for those mailservers to avoid other firewalls that may be in the way.

Note also that your domain name MIGHT scare the H-E double toothpicks out of your IT security guys. Mine did. So I had to stop proxying.

Wholly - Use promo code WhollyMindless for full 97$ credit until 12/11/07.


A tricky factor may be that the second mail server is NOT a DreamHost server, so I’m not sure that the DreamHost tunnel will forward ports to it.

Try it! I suspect that it will actually work unless DH gets mad. Since it’s an outgoing connection it will probably be allowed.

Wholly - Use promo code WhollyMindless for full 97$ credit until 12/11/07.