SSH Key Conversion to an OpenSSH compatible format

puttygen supports exporting your private key to an OpenSSH compatible format. You can then use OpenSSH tools to recreate the public key.

Open PuttyGen
Click Load
Load your private key
Go to Conversions->Export OpenSSH and export your private key
Copy your private key to ~/.ssh/id_dsa (or id_rsa).
Create the RFC 4716 version of the public key using ssh-keygen

ssh-keygen -e -f ~/.ssh/id_dsa > ~/.ssh/
Convert the RFC 4716 version of the public key to the OpenSSH format:

ssh-keygen -i -f ~/.ssh/ > ~/.ssh/

Useful Net::SSH2 commands

use warnings;
use strict;
use Net::SSH2;
use Data::Dumper;

# see maillist archives at

my $ssh2 = Net::SSH2->new();
$ssh2->connect(‘localhost’) or die “Unable to connect Host $@ \n”;
#this works for passwords
#$ssh2->auth_password(‘z’,’ztester’) or die “Unable to login $@ \n”;

#do key authorization like commandline shell
# ssh -o PreferredAuthentications=publickey localhost
# See:
# for setting up the keys

# this dosn’t work
#$ssh2->auth(username=>’z’, interact => 1);

# so get the password for the key
use Term::ReadKey;
print “And your key password: “;
chomp(my $pass = ReadLine(0));
print “\n”;

# works when run from z’s homedir because you need
# permission to read the keys
$pass );

my $sftp = $ssh2->sftp();
my $fh = $sftp->open(‘/etc/passwd’) or die;
print $_ while <$fh>;

#my $chan = $ssh2->channel();
#$chan->exec(‘ls -la’);
#while (<$chan>){ print }

# to run a remote command in the background
# you need to semi-daemonize it by redirecting it’s filehandles
my $chan3 = $ssh2->channel();
$chan3->exec(“nohup /home/zentara/perlplay/net/zzsleep > foo.out 2> fo
+o.err < /dev/null &"); $chan3->send_eof;

#to run multiple commands use a shell
#shell use
my $chan = $ssh2->channel();
print $chan “ls -la\n”;
print “LINE : $_” while <$chan>;
print $chan “who\n”;
print “LINE : $_” while <$chan>;
print $chan “date\n”;
print “LINE : $_” while <$chan>;

# file and directory operations
#will get dir named 2
#my $chan1 = $ssh2->channel();
#$chan1->exec(‘ls -la 2’);
#while (<$chan1>){ print }

# mkdir with sftp
#my $sftp = $ssh2->sftp();
my $dir = ‘/home/z/3’;
my %stat = $sftp->stat($dir);
print Dumper([\%stat]), “\n”;

#put a file
my $remote = “$dir/”.time;
$ssh2->scp_put($0, $remote);

#get a file
#use IO::Scalar;
#my $check = IO::Scalar->new;
#$ssh2->scp_get($remote, $check);
#print “$check\n\n”;

# get a dirlist
my $dir1 = ‘/home/z’;
my $dh = $sftp->opendir($dir1);
while(my $item = $dh->read) {
print $item->{‘name’},”\n”;

#shell use
my $chan2 = $ssh2->channel();
print $chan2 “uname -a\n”;
print “LINE : $_” while <$chan2>;
print $chan2 “who\n”;
print “LINE : $_” while <$chan2>;


Compile Android on Cordova

set ANDROID_HOME=C:\Program Files\Android\android-sdk-windows

set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools

Open a command line window, and go to /path/to/your/project/platforms/android/cordova.

cordova build android –release, from top level directory

Check for the keystore details..

Also keygeneration:

keytool -genkeypair -dname "cn=Mark Jones, ou=JavaSoft, o=Sun, c=US" -alias -keypass kpxx135 -keystore xyu.keystore

Debian Install Packages behind Firewall

apt-get --print-uris install mysql-server -y

Will print out the URL for the package and dependancies;

'' libaio1_0.3.109-3_armhf.deb 8944 MD5Sum:ddc43710db3f102df9477a8a95f025ad
'' mysql-server-core-5.5_5.5.40-0+wheezy1_armhf.deb 3060608 MD5Sum:9a8f4620799fcceb4567433caad2434e
'' mysql-server-5.5_5.5.40-0+wheezy1_armhf.deb 1729934 MD5Sum:98fe33dd64039ba120d1aa77e0992fa7
'' heirloom-mailx_12.5-2+deb7u1_armhf.deb 253508 MD5Sum:6155feba05b677f5f01eb5b53ae4ba2d
'' libhtml-template-perl_2.91-1_all.deb 72020 MD5Sum:b25cc0a02e43fe4b5b46a01af3e98c4c
'' mysql-server_5.5.40-0+wheezy1_all.deb 73872 MD5Sum:b49873c3a32d33f6186e779202f6a87e

Cut out the URLs and put them into a file.

y=0;for x in `cat deps.txt`; do ssh username@"wget -O - $x" >> $y.deb; y=$y+1; done

dpkg -i *.deb