Running scripts on Linux using Linx

Because Linx is a Windows service and application, we tend to think that we can only use it to run and manage Windows servers, however, because we can use the Commandline plugin on Linx, we can easily run tools that can access Linux.

One very often used example is the Plink tool (PuTTY Link).

With Plink you can run a Linux script using a user with sufficient rights. This script can then do anything which you would normally do if you’ve logged into the Linux bash (command prompt).

Before using Plink in an automation tool like Linx, you need to set it up so it does not keep asking for a password. To do this, follow section 7.2.2 here: PuTTY is the world's most popular free SSH and telnet client. Downloads, tutorials, how-tos, vulnerabilities.

Now you can use Linx to create a small batch script (.bat file) which will run Plink. Here’s an example:

@ECHO off
plink.exe root@192.168.1.102 /usr/local/Backup/do-backup.sh
ECHO Command finished…

Run this .bat file using the Linx Commandline control. Just remember that Linux, and other Unix based systems are case sensitive. Make sure you use the correct case for the directories, files and commands.

As an update, if you do not mind having your user’s password as part of the command (obviously there are security implications, but it all depends on your own implementation) you can use a command like this:

plink.exe 192.168.1.102 -l Username -pw password /usr/local/Backup/do-backup.sh

Another note, if you’re using newer versions of plink.exe you’ll need to add “-batch” to your commandlines.