How to Retrieve TeamViewer ID on Linux via SSH When “teamviewer –info” Returns “ID: not found”


2 views

When working with TeamViewer on headless Linux servers through SSH, you might encounter the frustrating situation where running:

teamviewer --info

returns:

TeamViewer ID: not found

This typically indicates the TeamViewer daemon isn't properly connected to TeamViewer's servers or has failed to register your instance.

Here are several approaches to retrieve your TeamViewer ID when the standard method fails:

Method 1: Check TeamViewer Log Files

The most reliable way is to examine TeamViewer's log files. Run:

grep -i "id" /var/log/teamviewer*

Alternatively, check the specific log file for your version:

cat /var/log/teamviewer8/TeamViewer8_Logfile.log | grep "My ID"

Method 2: Query the TeamViewer Config

TeamViewer stores configuration in an SQLite database. Try:

sqlite3 /etc/teamviewer8/teamviewer8.conf "SELECT * FROM Connection;"

Method 3: Force Daemon Reinitialization

If the ID isn't showing up, restart the daemon with:

teamviewer --daemon stop
teamviewer --daemon start
# Wait 2-3 minutes for server connection
teamviewer --info

If you still can't get an ID, consider these troubleshooting steps:

# Check if the daemon is running
ps aux | grep teamviewer

# Verify network connectivity
telnet master.teamviewer.com 5938

# Check license status (for commercial versions)
teamviewer --license status

If TeamViewer continues to fail, you might consider alternatives like:

# For SSH tunneling
ssh -R 5900:localhost:5900 user@your_client_machine

# Or using NoVNC
sudo apt-get install x11vnc
x11vnc -forever -shared -passwd yourpassword

Remember that TeamViewer on headless servers sometimes requires additional configuration compared to desktop installations.




When working with headless servers through SSH, running teamviewer --info sometimes returns an unhelpful "TeamViewer ID: not found" message. This typically occurs in these scenarios:
- Fresh TeamViewer installations
- Daemon crashes or improper shutdowns
- Network configuration changes
- Permission conflicts


Method 1: Check the log files

cat /var/log/teamviewer*/TeamViewer* | grep "My ID is"


Method 2: Direct database query

sqlite3 /var/lib/teamviewer*/config.db "SELECT * FROM Clients"


Method 3: Systemd service inspection

systemctl status teamviewerd.service -l
journalctl -u teamviewerd.service | grep "ID"



If all methods fail, completely reset the TeamViewer identity:

sudo teamviewer --daemon stop
sudo rm -rf /var/lib/teamviewer*/config.db
sudo teamviewer --daemon start

Wait 2-3 minutes for the daemon to establish new connection and display the ID.


Sometimes the missing ID indicates connectivity problems. Verify network routes work by testing:


curl https://www.teamviewer.com
netstat -tulnp | grep teamviewer



For production environments, create an automated ID checker:

#!/bin/bash
ID=$(teamviewer --info | grep -oP 'TeamViewer ID:\s*\K\d+')
if [ -z "$ID" ]; then
    systemctl restart teamviewerd
    sleep 30
    ID=$(teamviewer --info | grep -oP 'TeamViewer ID:\s*\K\d+')
    echo "$(date) - Regenerated ID: $ID" >> /var/log/teamviewer_monitor.log
fi