Dec
15
hsxkpasswd
Without sudo
(with perlbrew
)
Filed Under Computers & Tech, Security, My Projects, System Administration on December 15, 2015 | 2 Comments
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 http://install.perlbrew.pl | 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