Logging into PuTTY with Perl

When you use the SSH client PuTTY a lot, it can become quite tedious selecting your server and then writing in your username and password. That’s why I decided to write a short script in Perl to speed things up, and it looks like this:


use strict;
use warnings;
open my $copy, "| xclip";
print $copy Password";
close $copy;
my $external = `putty yourserver.com.au -l YourUsername -pw YourPassord`;

I’m copying my sudo password to the Linux application xclip so its ready in my clipboard, before opening PuTTY and automatically signing in. I then converted the script into an executable file using the instructions found here.

The following two tabs change content below.
Computational biology PhD candidate at the Australian National University. I love writing (both articles and software), learning more about the world around us, and beekeeping. I also write for BioSky.co

Latest posts by Jack Simpson (see all)

Comments are closed.