Scrot and Team Viewer

For those who dont know, scrot is a fast and easy command line screenshot tool. There are some cool stuff you can do with it, like combining it with team viewer. Team viewer is a non-free vpn-like solution to share your desktop with others and vice versa.


When you start team viewer it provides you with 2 numbers. These 2 numbers (ID and password) can be used by another team viewer instance to gain access to your machine. I’m not the biggest fan of team viewer, but it’s still pretty useful when you want to avoid port forwarding or even assist your non-geek windows/mac lover friends 😛

So, lets say you only have ssh access to your desktop and you suddenly feel the urge to use your X session. Running X applications over ssh with the ‘-X’ option is not always the best and fastest solution out there.

Provided that team viewer is installed on both remote and local machines and that scrot is installed to the remote machine (the one you want to gain access to) , open 2 ssh sessions to the remote machine.

Session 1:

$ export DISPLAY=:0.0
$ teamviewer

Team viewer is now running on the remote X session and we just need to take a screenshot of it in order to copy the 2 numbers to our local team viewer instance

Session 2:

$ export DISPLAY=:0.0
$ scrot mydesktop.png

You can use ssh’s internal sftp subsystem to grab this file. Open a ftp client and fill your ssh credentials ( host, username, pass, port ) .The default port for ssh is 22.
Personally i used my apache directory to view it without using the sftp solution.
If you have screensavers enabled then you can either kill it or just use another smart tool called “xdotool”. Xdotool lets you programatically (or manually) simulate keyboard input and mouse activity, move and resize windows, etc.

$ sudo apt-get install xdotool
$ export DISPLAY=:0.0
$ xdotool mousemove 88 99

Mouse movement will now disable your screensaver without killing it.

Share on FacebookTweet about this on TwitterShare on Google+Share on StumbleUponShare on RedditShare on TumblrShare on LinkedInEmail this to someone