Linux remote control

Control and Command

Article from Issue 163/2014
Author(s):

Turn your Android device into a handy remote control for your Linux machine.

Using an Android device to access and control remote Linux machines is hardly a new idea, and plenty of apps on Google Play can be used to manage Linux machines via SSH or VNC. Instead of using your Android device as a regular SSH client, however, you can turn it into a versatile remote control for your Linux machine. Several packages are available to help you with that, including Linux Remote Control, Remote Control for Linux, and Remote Launcher.

Linux Remote Control

Linux Remote Control (LRC) [1] is a lightweight solution that consists of two components: a Node.js-based server that runs on the host Linux machine and a web interface optimized for running on mobile devices like Android smartphones and tablets. LRC is easy to deploy and features a polished user-friendly interface, which makes it a perfect tool for less technical users (Figure  1). LRC is distributed as a .deb package, and it should run on all Ubuntu Linux derivatives.

Figure 1: Linux Remote Control features a polished and functional web-based interface.

To install LRC, grab the latest lrc.deb package from the project's website and install it by running the

sudo dpkg -i /path/to/lrc.deb

command. If you get an error message saying that the xbacklight package is missing, install the package using the

sudo apt-get install xbacklight

command. If you want to use LRC to control music and video players, you have to install the Rhythmbox and Totem Movie Player applications. This can be done by running:

sudo apt-get install rhythmbox totem

Next, move the lrc-client folder in the /opt directory to your mobile device. The easiest way to do this is to connect the mobile device to the machine with LRC and then copy the /opt/lrc-client directory to the desired location on the mobile device. Once you've done that, run the LRC server on the Linux machine using one of these commands:

node /opt/lrc-server/lrc.js
nodejs /opt/lrc-server/lrc.js

On your mobile device, open index.html in directory lrc-client in a browser. The first thing you need to do is to add a new server account. Press the Add Server button, give the new account a descriptive name, and enter the IP address of the Linux machine running the LRC server. Save the account and tap on the created entry to switch to the dashboard. From here, you access the available interfaces.

The Music interface allows you to control the Rhythmbox music player (Figure  2). From here, you control all key functions such as play and pause a track, go to next or previous track, and adjust volume. The interface also conveniently displays the basic info of the currently playing track. The Video interface provides the same functionality for video playback.

Figure 2: The Music interface allows you to control the Rhythmbox music player.

Besides controlling music and video, LRC can handle other tasks, too. The Controls interface can be used to perform basic system actions like shut down and reboot, lock and unlock the desktop, adjust screen brightness, and take a screenshot (Figure 3). You can also use the Send custom command field to enter a command and execute it on the Linux machine by pressing the Send command button.

Figure 3: Using the Controls interface, you can run custom commands on a remote Linux machine.

The Slideshow interface turns your mobile device into a presentation remote control (Figure 4). The Back and Forward buttons emulate the left and right arrow keys, so you can use the interface with practically any presentation software that can be controlled using these keys. If you use a presentation application like LibreOffice Impress, you can also use the dedicated buttons in the interface to start and stop the presentation.

Figure 4: With LRC, you can use your Android device as a remote control for presentations.

The Mouse button lets you switch to the Touchpad interface, which effectively transforms your mobile device into a remote touchpad. This feature can come in particularly handy when you need to control the desktop during the presentation. From the Touchpad interface, you can control the cursor by dragging your finger on the designated area of the screen, and you can use the dedicated buttons to emulate right and left mouse button clicks. When you are done, you can switch back to the Slideshow interface using the appropriate button.

LRC has a lot going for it. It's easy to deploy, and it uses a polished and functional web-based client interface (i.e., there is no need for a separate Android client app). Because LRC allows you to create multiple accounts, you can use the web interface to connect and control different Linux machines.

Remote Control for Linux

Similar to LRC, Remote Control for Linux (RCL) [2] is based on the client-server model, but it implements it in a slightly different way. RCL features a native Android app that lets you control a remote Linux machine via a Python-based server script. The server part requires no installation, so you can easily deploy it on any Linux distribution with Python 2.x. To do this, clone the pyRemoteControl GitHub repository [3] using the git clone https://github.com/raaapha/pyRemoteControl.git command.

In the terminal, switch to the resulting pyRemoteControl directory, and make the PyRemoteControl.py script executable using the chmod +x PyRemoteControl.py command. Launch the server with the ./PyRemoteControl.py command. Next, install the Remote Control for Linux app from the Google Play store. If you prefer to try the app before buying the paid version, you might want to opt for Remote Control Lite for Linux [4]. Launch the app, enter the IP address of the Linux machine running the PyRemoteControl server and press Connect.

Although the RCL app looks decidedly bare-bones compared with RCL's web-based slick interface, it does the job. The app's functionality is accessed in four screens. The Presentation screen allows you to control presentations (Figure 5). It does so by emulating left and right arrow keys, so it should work with any presentation system that supports these keys. Because the Presentation screen doesn't offer any other buttons, you need to launch and stop presentations manually.

Figure 5: RCL also allows you to use an Android device to control presentations.

Similar to the Touchpad section in LRC, the Mouse screen in RCL lets you control the cursor and emulate mouse button clicks. RCL also features the Keyboard screen, which gives you a virtual keyboard for text input on the remote Linux machine (Figure 6). Although using the Android device as a keyboard is not the most convenient way to enter text, this functionality can come in handy during presentations. Finally, the Media screen provides a no-frills interface for controlling media playback (Figure  7). It includes the usual assortment of buttons for adjusting volume, playing and pausing tracks, and moving to previous and next tracks.

Figure 6: RCL features a virtual keyboard for text input on the remote Linux machine.
Figure 7: The app provides a basic interface for controlling media playback.

Although RCL lacks the polish and features of LRC, it has one important advantage: The Python-based server can be easily deployed on practically any Linux distribution. So, if you are not using Ubuntu or its derivatives, and you are looking for a hassle-free solution for controlling your machine remotely, RCL can be a sensible choice.

Remote Launcher

As the name indicates, Remote Launcher [5] is not a remote control solution per se. It's a combination of an Android app and a Java-based server that allows you to launch applications and execute commands on a remote Linux machine. So, although Remote Launcher can't be used to command media players, run presentations, and control the cursor, it can be useful for performing simple tasks like launching applications and rebooting the machine.

To deploy Remote Launcher on the target Linux machine, install a Java Runtime Environment (JRE) on it first. Next, grab the latest version of the server component from the project's website and unpack the downloaded archive. In the terminal, switch to the resulting directory and run the ./install.sh command as root. You can then launch the server using the remote-launcher-server command.

Alternatively, you can run the server without installing it by running the ./remote-launcher-server command from the unpacked directory. This command starts the server with the graphical interface; however, if the target Linux machine doesn't have a graphical desktop, you can use the remote-launcher-server -d command to start the server in text mode.

During the first run, you'll be prompted to specify a password. Once the server is up and running, you have to add launchers to it. In the Remote Launcher Server window, choose Edit | Configure launchers and press the Add launcher button. Give the new launcher a name and a brief description and then enter the path to the application's executable in the Path field. For example, a launcher for the VLC media player should look something like Figure 8. You can also use the supplied templates as starting points for creating your own launchers. Choose the desired template drop-down list and edit at will.

Figure 8: Creating a VLC launcher.

With the Remote Launcher server configured and running, install the Remote Launcher app [6] (or its free version [7]) on your Android device. Launch the app, press the Add server button, and fill out the required fields. Save the configured connection, and press the Connect button to connect to the Remote Launcher server. You should then see a list of launchers. To start a specific application on the remote machine, tap on the desired launcher (Figure 9). If you opted for the paid version of Remote Launcher, you can also use the app to edit existing launchers and create new ones (Figure 10).

Figure 9: The free version of the Remote Launcher app in action.
Figure 10: Edit and create launchers with the paid version of the Remote Launcher app.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News