Thursday 26 December 2019

VNC, ssh, remote, Android, n00b

For the most part I've found ssh enough for connecting over home network, for file transfer purposes. But sometimes it's just helpful to share the screen, keyboard and mouse remotely.

Not every resource is on the same computer, and in the case of physical drives it might not even be desirable. I need to use Processing on the Mac, but it does not properly compile applications over the command line in the way I'd want to, and making Handbrake crunch a video from a drive that only exists on that other computer is a bit handier when you can see what's going on.

Of course on occasions I could just switch the display to show the other computer but then I'd still need to switch between two mice and keyboards.

So, VNC (Virtual Network Computing) screen sharing to the rescue. This needs the viewer software to view the other computer screen, and a server on that other computer that 'feeds' the screen to the viewer.

I used RealVNC's viewer to get the easiest results. With the Mini Mac, the VNC server was built-in and could be activated by ticking one box in the settings.

With Linux computers I found some hurdles, which on one hand might seem surprising, but perhaps really not. Whereas VNC viewer from RealVNC can be recommended, I did not go for the server, as it requires a subscription.

Being a newbie in this, I guess some protocols don't quite fit each other so it's not always obvious which server works with which viewer. Messing with TigerVNC did not produce the results I wanted, although it probably should do the work. Some Linux Mint versions have vino, but it is no longer part of the Mint install since 19, and I'm not sure I ever got that working either.

So, x11vnc as the server. Not sure if all the above solutions actually rely on it in the end somehow, but at least by using this simplest advice I could also connect the Linux Mints together. I rebooted the computer to get the server properly working.

It gets meta as I edit the blog post locally and have an eye on Handbrake converting video on the other computer. VNC viewer interface in the middle keeps track of past connections.
After this the computers can co-operate within the home network without additional hassle.

The Mac may whine a bit about a missing keyboard, but as you input something this will go away.

The keyboard mapping is one thing I've not yet figured out well, as even rather simple characters like _ and @ can be difficult to achieve straightaway, at least when using a Linux to get over to the Mac.

Predictably, video over VNC is not such a bright idea but is kind of doable, at least for the purposes of checking the contents. I encountered a hiccup when using VLC video player, trying to bring up the context menu with right mouse button shut down the screen sharing server. Hmm...

Playing 3D games is even less useful, but I just had to have a go at Tomb Raider from 2013. It was obviously very choppy even in a resized window, but what made it finally unplayable was that the relative mouse motion was not correctly interpreted.

For a while the silly me thought I need to use the IP address for the connections, but the computer hostnames do just as well and better, as the address can change.

Out of curiosity I also checked the situation for the Android Galaxy phone, as the VNC viewer is also available there as an app and works ok. Doing this the other way might be interesting but at first glance at least it seems to be a bit trickier to get the server running on the Galaxy. Arguably the VNC viewer over Android could work as an elaborate remote controller for another computer.

Other Android stuff

Speaking of remotes, the Android app remote Unified Remote (and the download for the corresponding server on Linux) DOES act as a remote way for moving the mouse pointer. I paid a little fee to get rid of the ads and it does seem to work as promised. This might reasonably work as a remote control for that laptop sitting next to the TV.

These softwares don't look very appealing, but you're not supposed to look at them, really.
After somewhat clunkily enabling the server as a browser app (!?) the movement on the Android touchscreen are transported to mouse movements on the target computer. There are also other functionalities such as launching software etc, but I'm not going over that stuff now.

As a hilarious experiment I could use the remote to hover the mouse pointer over to the VNC viewer window, to control the computer where the unified remote server is NOT running.

Somewhat against my expectations, the Unified Remote could not work reliably by having the server directly over the computer where the VNC server is also running. The pointer would fidget somewhat but would not move. Oh, well.

When it comes to having ssh over the Android phone, there is apparently a solution for accessing the Android system directly via cable and the developer mode. But for my purposes I have found it enough to be able to access the phone through wifi and ready-made Android helper apps.

Left: SSHelper server running on Android. Right: Termius, using tiv on another machine to display a png over the command line.
Termius acts as a simple terminal on the Android so you could access your computer with it (after enabling the ssh server obviously), whereas SSHelper is more comprehensive. I suppose it is a minimal linux-within-linux, as it sets up a small server on the Android, complete with a set of useful command line tools such as busybox.

Both have a kind of 'virtual' mapping of the Android filesystem so you can copy photos etc using scp  from the command line, and I had some success with remotely opening the folders through caja too. Nano on SSHelper together with Apple Bluetooth keyboard might be the closest to having a reasonable text editor on the phone.

Just something more

On another remotely related note, the Terminal Image Viewer tiv (from here) is quite good at displaying bitmaps over the command line terminal itself, using unicode blocks and colours to best effect.

A Big Fat ANSI Deal
Sadly it's not able to accommodate for a terminal wider than 80 characters. That might have helped reproduce 8-bit graphics and PETSCII jpgs rather faithfully... again, it's ok for checking a bitmap over the terminal.