## 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

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

Sometimes you might need to test whether a specific port is open in Linux based on your firewall rules. Without having to install specific software (e.g, telnet server for port 21) you can test this using netcat.
This can be handy if you need to prove to a service provider that they are blocking your ports.

Example, port 21

On the server side:
For ports under 1000 you must be root/sudo user

sudo netcat -l 21

On the client side

netcat [server ip] 21

It will look like nothing has happened. On the client side, just type some random words, e.g. “Hello World!” and hit [ENTER]. If the connection was successful, you should see the same words echoed on the server side.

To end the session you can either use CTRL+C on the server side (will kill both sides) or CTRL+D on the client side (will only kill the client side)

In a previous article, Linux – Enable auto-login via SSH, I explained how you can eliminate the need to enter your password every time you log on to a specific host.

You might run into a problem where you get the following error message:
“Agent admitted failure to sign using the key”

You then need to type in the password again. Pointless.

To fix it is quite simple:
Continue reading

Ubuntu text boot

First things first – remember, always back up important system files before editing!

If you want to view the tradional kernel message output when booting into Ubuntu, you can do it as follows:

Edit /etc/default/grub and edit the following line:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

Change it to:
Continue reading