Thursday, February 20, 2014

Replacing LogMeIn with TeamViewer on OSX and Linux


LogMeIn is no longer free and I'm not paying!

There are many remote desktop solutions and I have multiple ways of seeing my Linux desktop in emergency, but I've found TeamViewer (free for personal use) is a great replacement of LogMeIn on OSX.

I was accustomed to LogMeIn on OSX because it was always running and quite simple to remote from the web-console, LogMeIn Ignition, or even Android and iOS.  TeamViewer, although not the prettiest interface, works the same, supports multiple monitors, and even supports Linux. It also has advanced features such as file-transfer, meeting-mode, and video/audio conferencing -- but I'm not one to utilize such. TeamViewer does indeed have Android and iOS clients as well.

Go ahead and install the "All-In-One: TeamViewer full version" from TeamViewer.com/en/download for either Linux or OSX or both. If you choose, make them run at startup (as a daemon (service)). I also have a way around this as you will see further down.

Now the key settings to make TeamViewer work like LogMeIn is the following:

1) Create an account on TeamViewer.com !
2) Assign your client(s) to your account: TeamViewer>Preferences>General>Assign to account.
3) Set your client to unattended mode: TeamViewer>Preferences>Security>Password.

Presto change-o -- a LogMeIn replacement!

TeamViewer screencap

===============================================================


* The issue mentioned below seems to be fix in recent versions; However, I'll keep this info available: 


I had one issue that bugged me: On Linux, the client constantly bugged me with a pop-up and reported "click to disable" (the pop-up).  But it would never disable, no matter what.  So my solution is to NOT run TeamViewer upon startup; HOWEVER, I can still launch it via remote SSH login.

The key to this is that I still run LogMeIn Hamachi (Mesh VPN) on all my machines so that I always have SSH access to any of them (as long as Hamachi doesn't fail).

Now, from a remote machine, SSH into the Linux machine and perform the following:

env DISPLAY=:0 teamviewer

Don't close your SSH (preferably, run it from screen). This will set the GUI of TeamViewer to the default display (the monitor) and launch it properly -- now TeamViewer should be ready for a client connection.  (If it does not launch, see below regarding the daemon start command)

------------------------------------------------------------------------------------------------------------

Similarly, this can be done with OSX, but there seems to be a bug that requires a particular work-around that I was lucky to notice.  TeamViewer will need to be run twice -- once as sudo, and another as the user:

SSH into the OSX machine and run TeamViewer like so:

sudo /Applications/TeamViewer.app/Contents/MacOS/TeamViewer 

It should fail and report:
com.teamviewer.desktop: Invalid argument
com.teamviewer.teamviewer: Invalid argument

Now run it again without sudo:

/Applications/TeamViewer.app/Contents/MacOS/TeamViewer

This should launch TeamViewer and make it ready for a client connection.

If for some reason it fails to launch, try setting the display first with:

export DISPLAY=:0

===============================================================

I've had some occasions where the programs stay running or won't relaunch properly.  It's probably best to quit the program from the desktop GUI, but if all else fails, in Linux, we can use the killall command to stop the processes:

killall teamviewer
killall wineserver
killall TeamViewer.exe
sudo killall teamviewerd

(It turns out TeamViewer for Linux actually runs a custom version of wine to emulate the windows version.)

You should restart the daemon service after any kills, as the GUI client will not run without:

sudo teamviewer --daemon start

In OSX, it seems I could only quit TeamViewer from the Desktop and unfortunately not use the killall nor the kill commands.

You may have better success, you can find the processes with the following command:

ps aux | grep [Tt]eam[Vv]iewer

===============================================================

Other free options that you may research -- but likely require direct network connectivity or VPN and therefore do not work like LogMeIn or TeamViewer for "from anywhere" remote access:

Both Linux and OSX:
X11 Forwarding over SSH
NoMachine.com (NXRemote) -- I had played with version 3 which was SSH secure and as fast as RDP.  It created virtual desktops like RDP, but I had issues keeping it working.  Version 4 is now available and works differently -- it now connects to the actual desktop much as LogMeIn or x11vnc.  It is, however, direct access only until they release "NoMachine Anywhere." Android and iOS clients are in Alpha and not yet released.

OSX:
Preferences>Sharing>Screen Sharing (VNC) (There commandlines/files to enable, but different versions of OSX have different commands, so you may research that on your own.)

Linux (likely in your repositories) :
xrdp - RDP for X !
A ton of different VNC servers, but i like x11vnc best.

===============================================================

Related to the subject, here are RDP Clients:

OSX:
Microsoft RDP Client v2.1.1
Microsoft RDP Client v8.x (on a domain, use the "DOMAIN\username" syntax) ; Available on iOS also!

Linux (likely in your repositories):
Remmina+freerdp (xfreerdp) -- supports Microsoft's Network Level Authentication (NLA).

===============================================================

Related to the subject, here are alternatives to Hamachi (listing only cross-platform solutions):

ZeroTier One (RECOMMENDED - i have move off of hamachi onto this; with great success)
n2n - a Layer Two Peer-to-Peer VPN
SoftEther VPN Project
tinc vpn
freelan (no redhat, et al?)
Remobo -- I had tried this a long time ago, but didn't like it so much.  It might be worth a revisit.
NeoRouter Free (as opposed to the Mesh and Pro versions)

=========
Good Luck!
=========

8 comments:

  1. Hey, I was using logmein free version for a long time for remotely accessing computers. But now as free version is no longer available, I have discovered another very good alternative for remotely accessing computers: RHUB`s remote support servers. It works well.

    ReplyDelete
    Replies
    1. Thank you, I do not see Linux support for RHUB Remote Access which defeats the post idea entirely.

      I'm getting along well with NoMachine over Hamachi when i need my desktop. Mostly i just SSH though. I'll patiently await "NoMachine Anywhere" which may be a long wait. I am Hamchi dependant at the moment -- i need to investigate the other P2PVPN options i suggested in the post.

      Another (untested), cross-platform, 'freemium' LogMein replacement is imPcRemote (http://www.remote-control-desktop.com)

      For those who just need to connect someone else's computer to assist, you can consider one of the many "instant" (non-always-on) services like http://ShowMyPC.com, http://Mikogo.com, and http://Join.me

      Delete
  2. Hello! After launching TeamViewer through the command line, you can get your TeamViewer ID with:

    defaults read /Library/Preferences/com.teamviewer.teamviewer9 ClientID

    But how do you get your password??

    ReplyDelete
    Replies
    1. I've always used my "personal password" that i set when i installed it. it avoids having to use the randomly generated one.

      Delete
  3. When I run the command `sudo /Applications/TeamViewer.app/Contents/MacOS/TeamViewer` it just hangs and doesn't print the error messages. Same thing happens without sudo. What is wrong?

    ReplyDelete
    Replies
    1. i'm unsure why -- mine performs as expected. try reinstalling or re-running it and configuring it via desktop gui, then exit the app. this commandline is only really useful for when you forgot to start it, or it's not set for autostart. also, maybe it requires the desktop to be already logged in. my output:

      0 ✓ ster@Merlin ~ $ export DISPLAY=:0

      0 ✓ ster@Merlin ~ $ sudo /Applications/TeamViewer.app/Contents/MacOS/TeamViewer
      /Library/LaunchAgents/com.teamviewer.teamviewer_desktop.plist: Service cannot load in requested session
      /Library/LaunchAgents/com.teamviewer.teamviewer.plist: Service cannot load in requested session
      2015-05-18 09:07:07.156 TeamViewer[38647:2331421] Cannot remove an observer for the key path "BuddyLoginState" from because it is not registered as an observer.

      0 ✓ ster@Merlin ~ $

      0 ✓ ster@Merlin ~ $ /Applications/TeamViewer.app/Contents/MacOS/TeamViewer
      2015-05-18 09:07:21.155 TeamViewer[38655:2331609] Cannot remove an observer for the key path "BuddyLoginState" from because it is not registered as an observer.

      0 ✓ ster@Merlin ~ $

      Delete
  4. Thank you.Great work.Cool solution for Linux and Mac OS.
    These scripts works fine.
    10webhostingservice.com

    ReplyDelete

Comments, Suggestions or "Thank you's" Invited!