Unblocking TeamViewer on Linux
*Educational purpose only
TeamViewer is one of the most popular remote desktop (control) application available out there. It’s also cross-platform and offers a ‘free for personal use’ license. So I use it to help out friends & family with their issues sometimes.
Now it works fine until you start seeing a random popup with ‘Commercial use detected’ before each connection. At this point, TeamViewer becomes pretty much useless as each session will be disconnected after 5 minutes and so on…
“Okay, I get it, but what’s the solution?” - well. If you have a lot of patience and are lucky enough then go fill this official support form and your TeamViewer ID will be unblocked within a few weeks. I tried this way but unfortunately by the time they unblocked it, I had done some tinkering and lost that TeamViewer ID to a new one so no luck.
“Yeah Neh. I don’t think I can wait that long. You got something faster?” - hmmm. Using Linux? Yes, then I got it… follow along. If not then I’m sure the machine detection works in a similar way on other OSs too so you can get an idea from here.
“I tried a fresh reinstall, but still blocked” - They label your machine as evil. You gotta change its ID.
What is machine detection and how does it work?
To uniquely identify your machine in the crowd and eliminating the need of a new TeamViewer ID each time you run/reinstall it, some of your machine’s unique IDs and parameter hashes are stored on the TeamViewer server and each time you go online those hashes are sent to the server again to retrieve TeamViewer ID.
Below is an example of such an exchange obtained from TeamViewer menu Extras > Open log file… > TeamViewer14_Logfile.log
Activating Router carrier
KeepAliveSessionOutgoing::ConnectSuccessHandler(): KeepAliveConnect to router16.teamviewer.com successful
KeepAliveSessionOutgoing::KeepAliveChannelInitialized(): KeepAliveConnection to router16.teamviewer.com initialized
KeepAliveSession::KeepAliveChannelInitialized(): KeepAlive-Connection initialized with ID 0 (IP: 0.0.0.0), SendQueue 0 (0 Bytes), SendIndex 0, AckIndex 0, RemoteSessionID 50
KeepAliveSession::SendCompleteQueue(): SendQueue: 0 (0 Bytes), RemoteSession 50 (ClientID 0), Time: 0 ms
IdentifyRequest: ID = 0, IC = -1801590255, IsTemporaryID = 0, InitiativeGUID = 1b59cb26-6e24-4b9d-8259-3602f206b401, CanStoreGUID = 1, MIDHistory = {-1801590255_3b5111c17_0a331900000001eb|l1feb69aabc5947c1867a812f32bb784f:fc3fdb21a48f:59d0c1db2fdc11111f0a38de39e472b|alinux021feb69aabc5947c1867a812f32bb784f:fc3fdb21a48f:59d0c1db2fdc11111f0a38de39e472b}, MIDv = 0, MaxSupportedMIDv = 2, RebootHash = {60830716-f6ae-3d38-bc5e-e99570d16f76}, MIDFlags = 16, MIDForceUpdateFlags = 0, AttractionGUID = 00000000-0000-0000-0000-000000000000
TVRouterClock: received router time: 20190312T025722.427851
TVRouterClock Schedule next request in 43200 seconds
Login::Identify::ManageLogin(): ID: 1066611234 IC 1495071111 MIDv1
CKeepAliveClientClient::OnKeepAliveSucceeded(): Protocol 4 proxy xxx.xxx.xxx.xxx:8080, user=
TeamViewerIDTracker::UpdateMachineID: New machineID = 1066611234
LicenseTracker::UpdateMachineLicense() local license differs from master license
SyncManagersFunction::Start: current managerlist size: 0
Client logged in and online
As you might have figured the actual request to the TeamViewer server is IdentifyRequest
:
IdentifyRequest: ID = 0, IC = -1801590255, IsTemporaryID = 0, InitiativeGUID = 1b59cb26-6e24-4b9d-8259-3602f206b401, CanStoreGUID = 1, MIDHistory = {-1801590255_3b5111c17_0a331900000001eb|l1feb69aabc5947c1867a812f32bb784f:fc3fdb21a48f:59d0c1db2fdc11111f0a38de39e472b|alinux021feb69aabc5947c1867a812f32bb784f:fc3fdb21a48f:59d0c1db2fdc11111f0a38de39e472b}, MIDv = 0, MaxSupportedMIDv = 2, RebootHash = {60830716-f6ae-3d38-bc5e-e99570d16f76}, MIDFlags = 16, MIDForceUpdateFlags = 0, AttractionGUID = 00000000-0000-0000-0000-000000000000
Looks like mess? “Yes”. Alright. Let’s break down the important part.
ID
: TeamViewer ID (initially 0 at first run)IC
: Some secondary IDMIDHistory
: Unique Machine ID1feb69aabc5947c1867a812f32bb784f
:/etc/machine-id
or/var/lib/dbus/machine-id
fc3fdb21a48f
: Current active MAC Address59d0c1db2fdc11111f0a38de39e472b
:/ (Root FS) partition UUID
and the responce is, of course, Login
:
Login::Identify::ManageLogin(): ID: 1066611234 IC 1495071111 MIDv1
which contains correct values for ID
& IC
returned by the TeamViewer server.
“Ah. I see how it works. How do I hack it then?”
How to change machine identity?
Simple.
- Step 0: Cleanup
# completely remove the teamviewer app
sudo apt purge teamviewer
# remove all the residuals of it
rm -r ~/.config/teamviewer/
rm -r ~/.local/share/teamviewer/
sudo rm -r /root/.local/share/teamviewer14/
sudo rm -r /etc/teamviewer/
sudo rm -r /opt/teamviewer/
sudo rm -r /var/log/teamviewer14/
- Step 1: Change Machine ID
# remove current machine-id
sudo rm /etc/machine-id
sudo rm /var/lib/dbus/machine-id
# generate new machine-id
sudo systemd-machine-id-setup
# and copy(if don't fancy system reboot)
sudo cp /etc/machine-id /var/lib/dbus/
- Step 2: Change MAC address
# figure out the device id whose MAC address is in the logfile
# Menu>Extras>Open log files...>TeamViewer14_logfile.log
# let's say it's ethernet device with id elp7s0
sudo macchanger -r elp7s0
- Step 3: Profit!!! Just reinstall the TeamViewer and enjoy.
Final thoughts
Thankfully it works without changing / (Root FS) partition UUID
which can’t be changed for a mounted partition and could be a headache. Changing only the MAC address
will get you a new ID but you will still be blocked unless you reset machine-id
. For Mac, it should be very similar but for Windows, the machine-id
part will be totally different and the way MAC address
is updated is also different, but you get the idea.