How to launch TeamViewer to act as a server only using a shell?

I have root shell access to a server, but need to use graphical applications on it. How could I launch TeamViewer (that is already installed) on the linux server, so that I could get the ID and Password of the session?


Solution 1:

Found this here. I would recommend following the link, however, as the author does explain a bit more.

Basically, the script starts Teamviewer automatically at startup, takes a screenshot of the Teamviewer screen (which includes the ID and password), and attaches it to an email composed in Thunderbird.

Pretty nifty if you ask me. Hopefully it works :)

[sourcecode language="bash"]
echo ‘Loading TeamViewer…’;
teamviewer &
echo ‘waiting 20 seconds’;
sleep 20;
echo ‘Taking screenshot’;
import -window root YOURSCREENSHOTNAME.png;
echo ‘Creating email’;
thunderbird -compose “to=’[email protected]’,subject=’TV PWD’,attachment=’~/YOURSCREENSHOTNAME.png’,body=’login now’” &
echo ‘waiting 2 seconds’;
sleep 2;
xdotool key ‘ctrl+Return’;
[/sourcecode]

Solution 2:

If you have access to a headless server, or text-only server, this may not help you. However, if you can access the desktop of your Linux machine, you may create a bash script that will execute teamviewer upon login. You will have to check how to use your Linux machine's "autologin" process. Once the autologin is done, create another bash script that has to be part of the "auto started applications".