My company has a linux server (CentOS 6 VM) behind a corporate firewall, I have full root control of the VM, but I have no control over the firewall. There's an ssh server running on it, and I can ssh to it within the company network.

I would like to ssh to this VM when I'm outside of the company network. How do I achieve this?

This linux VM is running on a Mac host machine, which I can use logmein to connect, and then access the linux VM. I'd like to ssh directly to the linux VM.

I'm guessing there has to be some sort of handshake initiated by the linux VM to the outside machine for this to work?

  • Are you sure your company doesn't have a VPN setup for external access already? – crasic Aug 12 '11 at 4:38
  • 1
    Did you mean to post the same question, at the same time, to serverfault.com/questions/300380 ? – mlp Aug 12 '11 at 6:36

Use Hamachi. No opening of ports required for secure VPN tunnels. Use SSH through the VPN.

LogMeIn Hamachi is a hosted VPN service that lets you securely extend LAN-like networks to distributed teams, mobile workers and your gamer friends alike. In minutes.

  • I tried hamachi actually, but was hit with an error: hamachi: /lib/libc.so.6: version 'GLIBC_2.7' not found (required by hamachi) – KoKo Aug 12 '11 at 4:30
  • make sure that you have installed build-essential and lsb – kobaltz Mar 11 '12 at 23:01

The very best solution is to contact your network administrator and ask them to either open a TCP port for you in the firewall, or get a VPN connection to the network.

If you use any method that circumvents security (there are many out there, some of which are advertised on television in a way that makes it sound like a perfectly innocent thing to do), you could be at risk of losing your job, so make sure you go through the proper channels within the company to first obtain permission.

Maintaining internal network security is very important because companies have a legal responsibility to protect privacy.

  • +1... if you don't control the firewall, then someone else does, and they should be aware that you are doing this. – trpt4him Jul 20 '15 at 20:56

You can create a ssh tunnel from behindvpn to outsidevpn host.

behindvpn$ ssh -R 1234:localhost:22 outsidevpn

This will open port 1234 on outsidevpn host which will forward connections to port 22 on the behindvpn host.

Now you can connect to behindvpn host with:

$ ssh outsidevpn -p 1234

Note: You may need to make sure that your connection will not break for example due to inactivity or shell timeout.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.