## Generate Private Key
openssl genrsa -out private-key.pem 8196
 
## Generate Public Key using above Private Key
openssl rsa -in private-key.pem -out public-key.pem -outform PEM -pubout
 
## Encrypt a file named file.txt to a file named file.txt.encrypted
openssl rsautl -encrypt -inkey public-key.pem -pubin -in file.txt -out file.txt.encrypted
 
## Dectrypt an encrypted file named file.txt.encrypted to a file named file.txt.decrypted
openssl rsautl -decrypt -inkey private-key.pem -in file.txt.encrypted -out file.txt.decrypted

I experienced an elevated level of frustration today at grep’s inability to find what I was looking for in a plain text file? It was particularly irritating as I have, like all years prior, made some new years resolutions and one of them was to not become irate too quickly.

As things go however, the end result taught me some valuable new things!

The problem

I receive a bunch of fairly large XML files that I need to search for particular lines of text. ‘No problem’ I say! Linux command line was built for this and grep is the perfect tool for the job in this case.

Continue reading

Ubuntu and Google Chrome

The last few days, I’ve been repeatedly getting the following when I do an apt-get update on my Ubuntu Desktop (14.04, if that matters).

W: Failed to fetch http://dl.google.com/linux/chrome/deb/dists/stable/Release  Unable to find expected entry 'main/binary-i386/Packages' in Release file (Wrong sources.list entry or malformed file)
 
E: Some index files failed to download. They have been ignored, or old ones used instead.

Some light reading and specifically this post on OMGUbuntu, coupled with some instructions in the comments section, led me to the following solution which works for now.
Continue reading

ShrewSoft Logo

For those of us that need to connect to clients/partners that use the Cisco VPN utility, getting it to work on Linux can sometimes be a bit of a mission. Luckily the Open Source World always has one or more alternatives. In this case, ShrewSoft VPN.

Follow the steps in this guide carefully and you’ll have the client working and running in no time.
Please note, this post is an adaption of this StackExchange question/answer.
Continue reading

Java Logo

I had the issue today of not being able to install Java as can be seen below. (I snipped a lot of the garbage that we don’t need to see for the solution)

hendri@techedemic:~$ sudo apt-get install oracle-java9-installer 
< -----SNIPPED TO SAVE SPACE----->
.....
Do you want to continue? [Y/n] y
Setting up oracle-java9-installer (9b81+9b81arm-1~webupd8~1) ...
Downloading Oracle Java 9...
--2015-09-30 14:35:17--  http://www.java.net/download/jdk9/archive/b81/binaries/jdk-9-ea-bin-b81-linux-x64-09_sep_2015.tar.gz
Connecting to 10.1.1.10:3142... connected.
Proxy request sent, awaiting response... 403 Sorry, not allowed to fetch that type of file: jdk-9-ea-bin-b81-linux-x64-09_sep_2015.tar.gz
2015-09-30 14:35:17 ERROR 403: Sorry, not allowed to fetch that type of file: jdk-9-ea-bin-b81-linux-x64-09_sep_2015.tar.gz.
 
download failed
Oracle JDK 9 is NOT installed.
.....
< -----SNIPPED TO SAVE SPACE----->

Continue reading

Grub

It used to be easy to manage grub. Simple changes to /boot/grub/menu.lst you were a-for-away. If you run a dual-boot environment (e.g, Ubuntu and Windows) and you want to change your Grub config to boot to a specific OS these days however (with the advent of newer versions of Grub) there are different steps to follow.

In this example, I’m running Windows 7 and Ubuntu 14.04 on the same machine in a dual-boot configuration. I need Windows to be the default menu entry.

Step 1: Find the menuentry for the operating system you want to make the default boot option

hendri@mercury:~$ grep 'menuentry ' /boot/grub/grub.cfg
 
menuentry 'Ubuntu' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-531984cc-cdb4-4d22-9e98-2914966fd84e' {
        menuentry 'Ubuntu, with Linux 3.16.0-30-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.16.0-30-generic-advanced-531984cc-cdb4-4d22-9e98-2914966fd84e' {
        menuentry 'Ubuntu, with Linux 3.16.0-30-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-3.16.0-30-generic-recovery-531984cc-cdb4-4d22-9e98-2914966fd84e' {
menuentry 'Memory test (memtest86+)' {
menuentry 'Memory test (memtest86+, serial console 115200)' {
menuentry 'Windows 7 (loader) (on /dev/sda1)' --class windows --class os $menuentry_id_option 'osprober-chain-A4AE5922AE58EE74' {
    menuentry "Memory Tester (memtest86+)" --class memtest86 --class gnu --class tool {

In the above output, copy/record the Windows 7 (loader) (on /dev/sda1) text.

Step 2: Edit /etc/default/grub using your preferred editor and make GRUB_DEFAULT the text above

GRUB_DEFAULT="Windows 7 (loader) (on /dev/sda1)"
 
#save and exit

Step 3: Update grub

hendri@mercury:~$ sudo update-grub

That’s it. You should now have your Windows host boot by default

This guide is loosely based on the this post but I was unable to complete the installation because of the following error:

hendri@techedemic: /var/tmp/ixgbe-4.1.2/src $ dmesg
......snipped......
[12270.405508] ixgbe: Unknown symbol vxlan_get_rx_port (err 0)
[12428.182904] ixgbe: Unknown symbol vxlan_get_rx_port (err 0)
[13448.131090] ixgbe: Unknown symbol vxlan_get_rx_port (err 0)
[18947.596474] ixgbe: Unknown symbol vxlan_get_rx_port (err 0)
[18975.603555] ixgbe: Unknown symbol vxlan_get_rx_port (err 0)
......snipped......

So, here follows the same guide, but with the missing steps I needed to complete the installation.
As a reference, I was running Kernel 3.13.0-20 before this.
Continue reading