This post is part 37 of 37 in the series Taming the Terminal

Since we covered SSH in parts 29 & 30, Apple have changed how their desktop OS deals with the passphrases protecting SSH identities (key pairs). This provides us a good opportunity to have a look at the SSH Agent in general, and, how things have changed on the Mac in particular.

The good news is that while things have changed on the Mac, with a small amount of effort, you can get back all the convenience and security you had before.

Read more

Tagged with:

This post is part 36 of 37 in the series Taming the Terminal

The previous 13 instalments in this series related to networking, but we’re going to change tack completely for this instalment, and look at two un-reltaed, but very useful terminal commands – screen, and cron.

screen is a utility that allows for the creation of persistent virtual terminal sessions that you can disconnect from without terminating, and reconnect and pick up where you left off at a later time. screen is particularly useful when used in conjunction with SSH.

cron on the other hand is a system for automatically executing recurring tasks. It’s extremely flexible, and very useful for things like scheduling backups to run in the middle of the night.

Read more

Tagged with:

This post is part 17 of 75 in the series Programming by Stealth

At this stage in the series we have made very good progress towards understanding the core JavaScript language. However, there is still one very important piece missing – objects. We have mentioned them in passing in almost every instalment, and each time, we put them off until later. We finally remedy that in this instalment.

Read more

Tagged with:

While it’s very easy to install hsxkpasswd onto your system from CPAN – it’s literally just one command (see below) – it requires administrator access to the machine.

sudo cpan Crypt::HSXKPasswd

This is all well and good if you have administrator access and are sure you want the module installed system-wide. But, what if you don’t have admin access, or, what if you just want to experiment with the module in your own home directory? The answer is perlbrew, a system for running custom versions of Perl inside your home directory. No need for sudo, and what ever you install with perlbrew is entirely contained within your home directory. If you already have perlbrew installed and configured with a version of Perl greater than or equal to 5.16, you can skip to the final step. If not, you’ll need to make your way through all the steps.

Step 1 – Install perlbrew Into Your Home Dir

There are a few different ways of installing perlbrew, but I find the following method the simplest:

curl -L | bash

That should install perlbrew into your home directory, and it should tell you to append some code to the end of your ~/.bash_profile file, which you can do with the following command:

echo 'source ~/perl5/perlbrew/etc/bashrc' >> ~/.bash_profile

Once that’s done, close your Terminal window and open a new one (this is to pick up the new environment variables defined in ~/perl5/perlbrew/etc/bashrc). You’ll know the install has been successful if you can run the perlbrew command:

perlbrew version

Step 2 – Install a Compatible Version of Perl into perlbrew

The joy of perlbrew is that you can have as many versions of Perl installed at any one time as you like, and you can then switch between them with the perlbrew command.

You can install Crypt::HSXKpasswd, and hence the hsxkpasswd terminal command, into any version of Perl greater than or equal to 5.16.

The following command will install Perl 5.16 into perlbrew:

perlbrew install perl-5.16.0

Go off and make yourself a cup of your favourite beverage – this will take a while! 🙂

Once the install finally finishes, you can activate that version of perl (just on your account) with the command:

perlbrew switch perl-5.16.0

It’s important to note that if at any stage you want to disable perlbrew and get back to the default system version of perl, the command to do so is:

perlbrew off

Step 3 – Enable the perlbrew CPAN Client

If you haven’t already done so, enable the perlbrew CPAN client cpanm with the command:

perlbrew install-cpanm

Step 4 – Install Crypt::HSXKPasswd

Once you have perlbrew installed and configured with a compatible version of perl, you can install Crypt::HSXKPasswd with the following simple command:

cpanm Crypt::HSXKPasswd

You’ll know it’s worked if you can run the hsxkpasswd terminal command:

hsxkpasswd --version

Tagged with:

This is the second part of a two-part post – read part 1 here.

In part 1 we learned how to use the command line too hsxkpasswd to generate passwords, and how to use various flags to specify custom password generation configurations, and word sources. In this second part we’ll look at how to save these customisations for future use with .hsxkpasswdrc files.

Read more

Tagged with:

Since version 3.5, the Crypt::HSXKPasswd password generating perl module ships with a command line interface to the password generator called hsxkpasswd. This provides a way for non-Perl programers to access the vast majority of the module’s functionality.

The easiest way to install the module, and it’s accompanying terminal command is via CPAN:

sudo cpan Crypt::HSXKPasswd

Once the module is installed, you’ll have access to the hsxkpasswd terminal command.

Getting started is simple, run the command with no arguments at all and it will generate one password using the default settings:

bart-iMac2013:~ bart$ hsxkpasswd
bart-iMac2013:~ bart$

If you want more passwords, pass a number as an argument, and you’ll get that many passwords:

bart-iMac2013:~ bart$ hsxkpasswd 10
bart-iMac2013:~ bart$

Read more

Tagged with:

Firstly, thanks to everyone who runs beta versions of Crypt::HSXKPasswd – every bug you find makes the software that little bit better!

However, now that the software is in CPAN, many of you may well want to move away from the stand-alone beta releases, and start getting the module directly from CPAN. Before you install the module from CPAN, you should remove the beta from your system. You can do that in two easy steps:

  1. Install pm-uninstall from CPAN: sudo cpan App::pmuninstall
  2. Use pm-uninstall to remove the beta version of Crypt::HSXKPasswd: sudo pm-uninstall Crypt::HSXKPasswd

Tagged with:

This post is part 35 of 37 in the series Taming the Terminal

The previous instalment we introduced the HTTP protocol. In this instalment we’ll look at three terminal commands which make use of the HTTP protocol.

We’ll start by browsing from the terminal, and then move on to a pair of very similar commands for making HTTP requests from the terminal. These two commands can do many things, but we’ll focus on two specific use-cases, downloading files, and viewing HTTP headers.

Read more

Tagged with:

This post is part 34 of 37 in the series Taming the Terminal

In the previous instalment we finished a five-part series on SSH. Before moving on, lets take a moment to step back and look at the big-picture. The five SSH instalments are all part of the now long-running series on networking. We have been working our way through the networking stack since instalment 23. We started at the bottom of the stack, and have worked our way up. We are not exploring protocols in the Application Layer.

In this instalment we’re moving on from SSH to HTTP, the protocol that powers the world wide web.

Before we look at some HTTP-related terminal commands, we need a basic understanding of how HTTP works, so that’s what this instalment is all about.

Read more

Tagged with:

This post is part 33 of 37 in the series Taming the Terminal

This is the final SSH instalment. So far we’ve learned how to securely execute terminal commands on remote computers, how to securely copy files across the network using SSH, how to add both security and convenience to both those operations with SSH key pairs, and how to tunnel just about anything through SSH. In this final instalment we’ll look two approaches for creating SSH bookmarks, SSH config files, and SSH GUIs.

Read more

Tagged with:

keep looking »