Just happened to shut the TeamViewer from within the remote computer console and got kicked out of my session with no way to re-connect. Luckily i had ssh access to the same machine and tried a few things to get it working, as just issuing the command on the ssh'd terminal didn't go so well.
Googled a bit and noticed that few others have come across similar problems starting TeamViewer from the terminal, but couldn't find a simple method that worked. -didn't look that hard anyway-
Found out its a easy fix.
export DISPLAY=:0That should do it. All it seems to need is a proper $DISPLAY with the value set to where current display manager's running. Once that's taken care of, TeamViewer can be started as a background process with "&". It should work even better with something like "screen" but didn't try that. yet.