Setup Logmein Hamachi for SSH access behind firewalls, etc.


75 posts   Page 1 of 3   1, 2, 3
by Blunderbuss » Wed Apr 25, 2012 7:57 am
*Disclaimer* I only just figured out how to do this, but it seems handy so I"m sharing the method. If  you don"t understand anything, post and I"ll attempt to clarify.

If you don"t pay for a static IP address, or find yourself behind firewalls that you can"t control, this method will allow you to access SSH on your Raspberry Pi by installing client-side software to connect to a logmein hamachi network.

First, create a logmein.com account if you haven"t already, and from there, create a network (on the left).

Next, download the logmein hamachi client software for your remote machine (laptop, work machine, what have you) and connect that to your hamachi network.

Then, download the beta logmein hamachi .deb file. This is done via the command line easily enough with:

$ sudo wget https://secure.logmein.com/labs/logmein-hamachi_2.1.0.18-1_armel.deb

you may need to add a flag at the end of that line to disregard authentication, just check the terminal for anything it"s telling you to do and do it, such that you can download the file.

Install logmein-hamachi by running:

$ sudo dpkg -i logmein-hamachi_2.1.0.18-1_armel.deb

All interaction with this software is now done by running commands of the form:

$ sudo hamachi XX

Try running: "$ sudo hamachi -h" to see a list of the commands available to you.

Here"s what you want to run:

$ sudo hamachi login

$ sudo hamachi attach <INSERT YOUR LOGMEIN.COM EMAIL HERE>

$ sudo hamachi set-nick "pick something creative….perhaps RPI?"

At this point, take a break to go back to your logmein.com web account, which should now show that a raspberrypi device is attempting to access it (assuming you set it up that way, i.e. the default way). Grant it permission and while you"re there, write down the network ID for your newly created hamachi network. It should be something like 123-456-789.

Back on the RPi, run:

$ sudo hamachi do-join <the ID that you just wrote down>

You will then likely need to head back to that other machine and approve the request. Now when you launch your remote machines logmein hamachi software, you will see that the raspberrypi has been associated with an IP address that begins with a 5. Before you can SSH into it, go back to the pi one last time and run:

$ sudo /etc/int.d/ssh start

That will start the ssh server service, and allow you to control the RPi terminal remotely.

Back on your host machine, open up your favorite SSH program (putty on the PC, terminal on the mac) and run ssh <a href="mailto:pi@pi@<insert the IP that the raspberrypi is showing in your hamachi software> NOTE: the user pi is for the latest debian release, so adjust accordingly.

Type in your password and voila! You can access the SSH server of your RPi from behind any firewall, provided that you install logmeins hamachi software from the machine you want to use to access the RPi.
Posts: 16
Joined: Sun Feb 19, 2012 12:05 am
by tomhannen » Mon May 14, 2012 8:40 pm
Hmm.. I can't install hamachi. I get the following error:

Code: Select all
 logmein-hamachi depends on lsb-core (>= 3.0); however:
  Package lsb-core is not installed.


So I googled around a bit, and tried installing:

Code: Select all
sudo apt-get install lsb-core
sudo apt-get -f install lsb-core


but it didn't work :

Code: Select all
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
pi@raspberrypi:~$ sudo dpkg --install logmein-hamachi_2.1.0.18-1_armel.deb
(Reading database ... 46703 files and directories currently installed.)
Preparing to replace logmein-hamachi 2.1.0.18-1 (using logmein-hamachi_2.1.0.18-1_armel.deb) ...
Unpacking replacement logmein-hamachi ...
dpkg: dependency problems prevent configuration of logmein-hamachi:
 logmein-hamachi depends on lsb-core (>= 3.0); however:
  Package lsb-core is not installed.
dpkg: error processing logmein-hamachi (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 logmein-hamachi
pi@raspberrypi:~$ sudo apt-get -f install lsb-core
Posts: 12
Joined: Sun Jul 31, 2011 9:27 am
by elf341 » Sat May 26, 2012 10:55 pm
tomhannen,
try the following:

Code: Select all
sudo apt-get update


then

Code: Select all
sudo apt-get -f install


then like above:

Code: Select all
sudo dpkg -i logmein-hamachi_2.1.0.18-1_armel.deb


That should work.
Posts: 1
Joined: Sat May 26, 2012 10:52 pm
by bsan » Sat Jun 02, 2012 12:50 am
$ sudo hamachi attach <INSERT YOUR LOGMEIN.COM EMAIL HERE>

$ sudo hamachi set-nick "pick something creative….perhaps RPI?"

At this point, take a break to go back to your logmein.com web account, which should now show that a raspberrypi device is attempting to access it (assuming you set it up that way, i.e. the default way). Grant it permission and while you"re there, write down the network ID for your newly created hamachi network. It should be something like 123-456-789.


Hi. Thanks for the help but it didn't work for me.
After running the attach command nothing apears on my logmein web interface to aprove!
Any ideas? thanks.
Posts: 6
Joined: Sat Jun 02, 2012 12:47 am
by tim1357 » Sat Jun 02, 2012 9:04 am
Thanks very much for this, it's exactly what I wanted to do. I've set up hamchi all okay, but when I go to SSH into it from my machine, I get this error:

Code: Select all
BlahBlah:~ Tim$ ssh <a href="mailto:pi@pi@5.hidden.hidden.hidden">

-bash: syntax error near unexpected token `newline'


Any ideas? Does my Pi have to have a static IP or is dynamic okay?
Thanks.
Posts: 8
Joined: Tue Apr 17, 2012 5:58 pm
by danhamilt1 » Sat Jun 02, 2012 9:44 am
tim1357 wrote:Thanks very much for this, it's exactly what I wanted to do. I've set up hamchi all okay, but when I go to SSH into it from my machine, I get this error:

Code: Select all
BlahBlah:~ Tim$ ssh <a href="mailto:pi@pi@5.hidden.hidden.hidden">

-bash: syntax error near unexpected token `newline'


Any ideas? Does my Pi have to have a static IP or is dynamic okay?
Thanks.


Ok your syntax for the ssh arguments is incorrect. It would seem that you have copied HTML with the user information directly from a webpage?

I suggest doing a "man ssh" to get a general idea of the usages of the ssh command as it will be useful to know for future as you can set up public and private keys so now password is needed etc.

However - For now you will probably want something along the lines of:
"ssh pi@5.hidden.hidden.hidden"
(Assuming that you have input the hidden parts yourself)

A quick explanation in leyman's terms of this command is "I want to secure shell (ssh) as User: pi at (@) Location: 5.hidden.hidden.hidden"

ssh will never accept syntax such as <a > etc as this is HTML and is just an error in your copying of the address. It will also only ever accept one username, in your example you had pi@pi@ my small example above basically explains the issue here.

As I said reading the man page will be very useful!

Hope this helps!
Posts: 14
Joined: Sat Jun 02, 2012 9:32 am
by tim1357 » Sat Jun 02, 2012 5:15 pm
Thanks, I thought it was very odd having HTML in an ssh command (I was simply following the OP's instructions).

Think I might try a different approach to this, all I wanted was to be able to SSH and VNC to my pi from outside of my Local network, could I do this with port forwarding? Thanks.
Posts: 8
Joined: Tue Apr 17, 2012 5:58 pm
by danhamilt1 » Sun Jun 03, 2012 3:44 pm
tim1357 wrote:Thanks, I thought it was very odd having HTML in an ssh command (I was simply following the OP's instructions).

Think I might try a different approach to this, all I wanted was to be able to SSH and VNC to my pi from outside of my Local network, could I do this with port forwarding? Thanks.

Ah my apologies haha it would seem I hadn't even noticed that the OP had done that!

Ok so another approach would be to set a static IP for your pi on the local network and then just use portforwarding as you say!

You would then just ssh in using "ssh pi@yourexternalip" as default ssh port is 22 so if you forward port 22 on your router to the static IP you have set up on the pi. This should be fine!

Assuming that you are ssh'ing from a Unix based machine with X11 installed you should be able to just use X11 to run the desktop environment.

For this:
1. ssh in using "ssh pi@yourexternalip -X" (make sure its a capital X. This allows X to be forwarded through the ssh")
2. type "startx".

I have had trouble setting this up sometimes but usually it works first time. If it doesnt work you might have to allow X11 forwarding in your sshd_config file (once again assuming your on a Linux/OSX machine)
Posts: 14
Joined: Sat Jun 02, 2012 9:32 am
by Clive GW0PPO » Fri Jun 22, 2012 10:58 am
Hi I have followed your instructions for installing Hamachi on my Raspberry Pi and after a bit of effort managed to complete the install.

I can list the instructions but when I try to run any other instructions it says. you don't have permission to control the Hamachi Daemon.

Any ideas what I need to do next?

Thanks in advance and regards Clive.
Posts: 3
Joined: Fri Jun 22, 2012 10:52 am
by danhamilt1 » Fri Jun 22, 2012 2:48 pm
You might have to "sudo" before the command if your not logged in as root
Posts: 14
Joined: Sat Jun 02, 2012 9:32 am
by Clive GW0PPO » Fri Jun 22, 2012 3:28 pm
Hi and thanks for the advice. I had just come to the same conclusion before reading your reply. I now have managed to request permission to join my Hamachi network and granted permission from my Laptop. I am now stuck trying to start SSH on my Pi!

Having a rest now as my little grey cells have been servilely stretched!

Regards Clive
Posts: 3
Joined: Fri Jun 22, 2012 10:52 am
by danhamilt1 » Fri Jun 22, 2012 11:24 pm
Clive GW0PPO wrote:Hi and thanks for the advice. I had just come to the same conclusion before reading your reply. I now have managed to request permission to join my Hamachi network and granted permission from my Laptop. I am now stuck trying to start SSH on my Pi!

Having a rest now as my little grey cells have been servilely stretched!

Regards Clive


Haha! The key is to keep stretching!

So have you not SSH'ed to the Pi yet at all? (without hamachi installed?)

In the Debian squeeze image, SSH is not enabled as standard. So, hopefully, this is the issue.

http://steve.dynedge.co.uk/2012/05/29/e ... pberry-pi/ this seems like a pretty good run through to enable SSH.

Though its pretty much just the case of running "sudo mv /boot/boot_enable_ssh.rc /boot/boot.rc" and then rebooting the Pi.

I also see the OP has written about running "sudo /etc/init.d/ssh start"?

I know that if you follow the run through I linked that it will enable ssh on every boot as a daemon, I think the OP's way will only enable ssh for the current boot (So on restart you will have to type it again).

Let me know how you get on as I have not actually tried it myself alongside Hamachi, I only enabled it when I tried out the squeeze image. I use the fedora release myself.

Hope it works!
Posts: 14
Joined: Sat Jun 02, 2012 9:32 am
by Clive GW0PPO » Sat Jun 23, 2012 10:31 am
Thanks for the link ref enabling SSH at every reboot. I will give it a try and report back with my findings!

Regards Clive
Posts: 3
Joined: Fri Jun 22, 2012 10:52 am
by joefly » Mon Jun 25, 2012 4:00 pm
Blunderbuss wrote:$ sudo /etc/int.d/ssh start



Hi I am following the instructions posted at the beginning and got stuck on this line. I think there is a mis-spelling.

I think it is suppose to be
Code: Select all
$sudo /etc./init.d/ssh start


hope this helps the beginners out there who may get stuck like me on this.
Posts: 52
Joined: Thu May 31, 2012 4:10 pm
by joefly » Mon Jun 25, 2012 4:31 pm
ok I got everything except the last step. using Putty to ssh into RPI

I assume the line that I need to enter into Putty is "pi@5.x.x.x" but where do I enter this in Putty. in the host name field with port 22. and connection type SSH then just hit open connection?

Sorry for a seemingly basic question but help would be appreciated.
Posts: 52
Joined: Thu May 31, 2012 4:10 pm
by danhamilt1 » Mon Jun 25, 2012 6:59 pm
joefly wrote:ok I got everything except the last step. using Putty to ssh into RPI

I assume the line that I need to enter into Putty is "pi@5.x.x.x" but where do I enter this in Putty. in the host name field with port 22. and connection type SSH then just hit open connection?

Sorry for a seemingly basic question but help would be appreciated.


Yes host name is the IP address of your RPI on hamachi. However you should not need the "pi@" bit. As I said in one of my last posts the bit before the "@" is the username. I think/hope it will ask for your credentials itself. I personally haven't used PuTTY but have used a few SFTP clients in which login is similar. Give it a go and report back :D
Posts: 14
Joined: Sat Jun 02, 2012 9:32 am
by joefly » Mon Jun 25, 2012 7:15 pm
I just tried again and no go.

Background.

in my logmein screen, my pi is named "rpi" and has a consistently green dot, even though I am turned off on my pi, is this normal.

I tried "5.x.x.x" or "rpi@5.x.x.x" or "pi@5.x.x.x" or "pi@pi@5.x.x.x" it all showed network timed out error.

I am not sure I am established the connection correctly between my logmein and pi. Although my logmein shows the pi, eventhough if I am turned off on the pi. How can I verify that the connection is made between logmein and pi.

On the pi, i did "sudo hamachi login" says already logged in. I did "sudo /etc/init.d/ssh start" and said server started.

but how to confirm that I am connected with logmein
Posts: 52
Joined: Thu May 31, 2012 4:10 pm
by danhamilt1 » Mon Jun 25, 2012 10:06 pm
It could be that when you have rebooted your RPI that ssh has been disabled again?

Try the ssh start command again once the RPI is on and then attempt to connect.

As for the green light being on, try doing a ping on the hamachi program and see if it goes red. Could just be a delay when you turn off the RPI to when hamachi knows its off.
Posts: 14
Joined: Sat Jun 02, 2012 9:32 am
by joefly » Tue Jun 26, 2012 3:58 pm
Blunderbuss wrote:$ sudo hamachi do-join <the ID that you just wrote down>

You will then likely need to head back to that other machine and approve the request. Now when you launch your remote machines logmein hamachi software, you will see that the raspberrypi has been associated with an IP address that begins with a 5. Before you can SSH into it, go back to the pi one last time and run:


HI guys

I finally got it to work but feel really stupid. originally, I interpreted the above as the desktop software as the web logmein website, because when I went to install hamachi it just took me to this website. Revisiting this instruction, it seemed strange that I can ssh from my putty without additional software, I thought it was some magic of logmein. So my original suspicion is correct, need to install Himachi software

do this by going to network and add client on this computer and it will at this point prompt for download to install software. Again hopefully this added detail will help newbies..

Thanks guys, and sorry for wild goose chase!!
Posts: 52
Joined: Thu May 31, 2012 4:10 pm
by danhamilt1 » Tue Jun 26, 2012 4:07 pm
joefly wrote:
Blunderbuss wrote:$ sudo hamachi do-join <the ID that you just wrote down>

You will then likely need to head back to that other machine and approve the request. Now when you launch your remote machines logmein hamachi software, you will see that the raspberrypi has been associated with an IP address that begins with a 5. Before you can SSH into it, go back to the pi one last time and run:


HI guys

I finally got it to work but feel really stupid. originally, I interpreted the above as the desktop software as the web logmein website, because when I went to install hamachi it just took me to this website. Revisiting this instruction, it seemed strange that I can ssh from my putty without additional software, I thought it was some magic of logmein. So my original suspicion is correct, need to install Himachi software

do this by going to network and add client on this computer and it will at this point prompt for download to install software. Again hopefully this added detail will help newbies..

Thanks guys, and sorry for wild goose chase!!


Haha I see. So your main machine actually wasn't connected to Hamachi? This makes sense.

I was running out of ideas myself!
Posts: 14
Joined: Sat Jun 02, 2012 9:32 am
by tobie » Tue Jun 26, 2012 7:47 pm
Great tutorial, and Hamachi is a great utility.

A couple of resources to add to the OP's excellent walk-through:

This page of LogMeIn carries links to Hamachi packacges for other ARM distributions, it also mentions to install LSB 3.0 before Hamachi:

Code: Select all
$ sudo apt-get install lsb


For me LSB required lots of dependencies so it might take a while.

Also here is a read me of CLI options for Hamachi once its installed, though these appear outdated?

I found it useful to restart the hamachi daemon once after making changes to /etc/network/interfaces:

Code: Select all
sudo /etc/init.d/logmein-hamachi restart
Posts: 11
Joined: Tue May 15, 2012 5:15 pm
by locaded » Sun Jul 22, 2012 7:27 pm
I'm using the latest wheezy image (2012-07-15) and the Hamachi installation steps from above just resulted in errors saying somthing about wrong architecture (armhf / armel) or saying I still don't have an LSB version (lsb-core >= 3.0).

After long trying following did work for me:
Code: Select all
sudo wget https://secure.logmein.com/labs/logmein-hamachi_2.1.0.68-1_armel.deb
sudo apt-get update
sudo apt-get install --fix-missing lsb lsb-core
sudo dpkg --force-architecture --force-depends -i logmein-hamachi_2.1.0.68-1_armel.deb


This successfully installed Hamachi and I was able to configure it as described in this tutorial.
Posts: 4
Joined: Sun Jul 22, 2012 12:11 am
by Neuromantic » Sat Jul 28, 2012 8:06 pm
I have installed hamachi as per the previous post and the initial instructions were giving errors but now I am unable to login to hamachi, I keep getting a failed error. I have been trying to run the debug command to see what's going on but that does not seem to be part of hamachi any more... Has anyone else had any problems or have any hints to help me resolve this?
Thanks,
Tom
Posts: 2
Joined: Mon Mar 05, 2012 8:22 pm
by trekrich » Sun Aug 05, 2012 6:17 pm
Hello,

Thanks for the info but i have a problem! The version mentioned at the start of the post is no longer on the server to download. I have tried downloading the current version and i get this error message when i try to install it.

root@raspberrypi:~# sudo dpkg -i logmein-hamachi_2.1.0.68-1_armel.deb
dpkg: error processing logmein-hamachi_2.1.0.68-1_armel.deb (--install):
package architecture (armel) does not match system (armhf)
Errors were encountered while processing:
logmein-hamachi_2.1.0.68-1_armel.deb

I am guessing that logmein have changed the requirements for the arm version of their software. Does anyone have the logmein-hamachi_2.1.0.18-1_armel.deb that they could send me please? I dont mind giving out skype details so that i can be sent over.

Thanks for all your help!

Richard
Posts: 6
Joined: Sun Aug 05, 2012 6:12 pm
by danhamilt1 » Sun Aug 05, 2012 8:27 pm
trekrich wrote:Hello,

Thanks for the info but i have a problem! The version mentioned at the start of the post is no longer on the server to download. I have tried downloading the current version and i get this error message when i try to install it.

root@raspberrypi:~# sudo dpkg -i logmein-hamachi_2.1.0.68-1_armel.deb
dpkg: error processing logmein-hamachi_2.1.0.68-1_armel.deb (--install):
package architecture (armel) does not match system (armhf)
Errors were encountered while processing:
logmein-hamachi_2.1.0.68-1_armel.deb

I am guessing that logmein have changed the requirements for the arm version of their software. Does anyone have the logmein-hamachi_2.1.0.18-1_armel.deb that they could send me please? I dont mind giving out skype details so that i can be sent over.

Thanks for all your help!

Richard


Hi Richard, have you tried the instructions left by locaded a few posts back?

This mentions about the new wheezy image and armhl problems.
Posts: 14
Joined: Sat Jun 02, 2012 9:32 am