Shellshock – What To Do To Make Yourself Safe

Shellshock is a vulnerability in the Bash shell. A shell is the program that provides a command line interface. Bash is the default shell in the Ubuntu universe. The Bash shell is vulnerable to a particular type of attack, described here: GNU Bash Remote Code Execution Vulnerability (CVE-2014-6271).

To determine if your Ubuntu box is vulnerable, Type the following at a command line, and then press enter. It is probably easiest to copy this and paste it into the terminal window, it must be typed exactly as shown and the spaces are important.

env x='() { :;}; echo vulnerable’ bash -c “echo this is a test”

If your system has the vulnerability, the output to the terminal window will be:

vulnerable
this is a test

If your system is secure, the output to the terminal window could show one of two things. One is this longer message:

bash: warning: x: ignoring function definition attempt
bash: error importing function definition for `x’
this is a test

The other, shorter message is simply:

This is a test

If you find you have the vulnerability you can update your system to a patched version of Bash by entering the following at a command line and then pressing enter:

sudo apt-get update && sudo apt-get upgrade

You will be prompted for your password. A lot of screen output will be displayed, and eventually you will be returned to a command prompt. You can then repeat the above test to check that the vulnerability has now been secured.

Following my own updates on my Trusty Tahr 14.04 the version of Bash I was upgraded to is version 4.3.11(1)-release, and this passes the vulnerability test.

Tags : , ,

Fast and Easy Access to Network Shares – Enter the Gigolo

Mounting a Windows or other OS drive across a network can be a challenge in Ubuntu. Samba is great but it certainly takes a bit of getting used to. If you´re in a hurry it can be a bit cumbersome and fiddly to set up. If the need to have the connection to the other OS is a short-lived one, there is even less incentive to go through the whole rigmarole to get the connection set up.

Gigolo is a great utility that has saved me time as well as finger and brain-ache on more than one occasion. It is available in the Software Centre.

To use it is very straightforward. Firing up the software brings up the main window.

Gigolo Main Window
Gigolo Main Window

Click on the Connect icon and complete the details for your connection in the Connect to Server dialog. Pick the appropriate type of connection from the Service type drop-down menu and the fields that are required in order to complete the connection are displayed. These fields differ from connection type to connection type. The ones that appear when you select a Samba share are shown below.

Connect to Server Menu
Connect to Server Menu

Provide the required information as appropriate for your connection, and then click the Connect button. If one is required you will be asked for a password. The Connect to Server dialog closes and you are returned to the main Gigolo window. You should have en entry in the main window representing your connection.

You can double-click it to open a file browser window on your Samba share, or highlight it and click the terminal icon in the toolbar to open a terminal window on your shared resource.

Gigolo With Active Connection
Gigolo With Active Connection

You can also create bookmarks in Gigolo so that you don’t need to re-enter the details of a connection that you wish to re-use, and you can select to have the shared resource automatically connected each time your system is restarted.

Tags : , ,

Setting File Associations at the Command Line

I use Freemind, the FOSS mind-mapping software, as a thought capture and organisation tool. When I upgraded to Trusty Tahr 14.04 I forgot to re-install Freemind. I subsequently tried to open an existing mindmap file (a Freemind file with an extension of .mm) but it opened in gEdit, the default Ubuntu test editor.

Realising I hadn’t put Freemind back onto my desktop since the upgrade, I fired up the Software centre and installed Freemind. I double-clicked the .mm file again but it still opened in gEdit.

OK, looked like I needed to set the default application for the .mm file type. I right-clicked the .mm file and highlighted Open With in the context menu. Darn – Freemind wasn’t listed in the daughter menu.

Next step was to select the Other Application… option from the context menu. This allows you to select the default program from a list of installed applications. But Freemind wasn’t listed there either!

I did a bit of reading and found the mimeopen command, which saved the day.

I opened a terminal window, cd’d to the folder with the .mm file and executed:

mimeopen -d FirstOrderLogic.mm

I was presented with a text mode menu in the terminal:

Please choose a default application for files of type application/x-freemind

1) FreeMind (freemind)
2) LibreOffice Writer (libreoffice-writer)
3) Geany (geany)
4) gedit (gedit)
5) Other…

use application #

That was great – Freemind was listed in the menu. I entered the digit 1 as my response and pressed enter. Freemind was then fired up automatically and the file loaded.

From that point onwards the association between Freemind and .mm files was established, and double-clicking any .mm files invoked Freemind to correctly launch and open the target file.

Even if Freemind hadn’t been listed in the mimeopen menu, I could have used option 5 and then specified the application I wanted to use by name. In my case this would have been:

freemind %f

Where the %f represents a token which is replaced at run time by the name of the file on which you have double-clicked.

Tags : , ,

Saucy, a US keyboard and the £ sign

Well, time´s gone by, and I did eventually get my desktop up onto Raring. For the most part it has been stable and well-behaved, and a good daily driver. Of course, along came Saucy. I tried that on my desktop and had issues with the App Centre (of all things) so I had to roll back.

On the other hand Saucy has taken to my laptop without any issues what so ever, and I would even go as far to say it is the best Ubuntu experience I´ve had yet. It is fast and responsive, looks good and works perfectly with the hardware of my laptop. It´s an Intel Core i7, Nvidia GeForce 610M-powered ASUS. And it flies.

There is one peculiarity with it, it has an American keyboard and I want to get UK characters out of it, such as the UK pound sign £. You can do this by setting the keyboard to English (US, Alternative International).

I can then type a £ by holding the menu key (alongside the right Alt key) and pressing the = key, releasing both and then quickly pressing the l key. Bit of a faff, but it works.

I´m going to give it a few more weeks and then try Saucy on my desktop again.

GTK+ 3 and SQLite Installation Commands

Having recently re-installed my Ubuntu system with Raring Ringtail, I needed to install the development tools I use most frquently. The first time I did this I struggled to get everything installed and working. It was one of those situations where you try so many things you can’t remember exactly which combination of events took place in which order, and you end up staring at your history file trying trying to work out which particular invocations were the ones that worked.

I usually program in C, using the GTK+ 3.0 libraries and SQLite. I also sometimes use the Geany IDE, Nemiver debugger front-end, Glade UI designer and Git. For Git I either use the Git CLI commands or gitg or Smartgit/Hg. These are all easy to locate and install, with Geany, Glade and Nemiver both readily accessible through the Ubuntu Software Centre.

I’ve managed to backtrace through my previous flounderings and have got two single CLI commands that install the GTK and SQLite libraries for me. I’m recording them here so that I know where to find them next time.

To install the GTK libraries enter this in a terminal window:

sudo apt-get install libgtk-3-dev

To install the SQLite libraries enter this in a terminal window:

sudo apt-get install sqlite3 libsqlite3-dev

Tags : , , ,

Raring to go? Nope, Raring to stay.

A lot of people have been reporting their success with Saucy Salamander, the latest version (13.10, October 2013 release) of Ubuntu.

I tried to move to Saucy Salamander. This was the first release that Canonical recommend the 64bit version if you have 64bit hardware. Up to this point they’d always recommended the 32bit version unless you had a specific reason to go 64bit. I’ve got 64bit hardware so I was excited to think that at last I’d have a 64bit OS running on it.

Sadly, in my case, the 64bit version was a disaster. It crashed repeatedly, and with the least provocation. Never having had much success with upgrades I’d gone straight to the full install option too, which should have given Saucy the best possible chance of stability.

Undeterred, I thought I’d try again with the 32bit version. Perhaps the 64bit wasn’t as robust on all hardware as Canonical believed. Again I went for the full installation but, alas, it was just like the 64bit version: flaky in the extreme.

I have to have a stable machine. I don’t mind some minor gripes here and there, and if it helps Canonical for me to be an early adopter and to submit error reports then fine, I’ll do that, and I have done so in the past. But only if for the most part I can have clean running. I’ve got a desktop and two laptops all on Ubuntu, they have to be stable and dependable.

I had no option but to roll back to Raring Ringtail, 12.10.

Saucy looks great and was fast, and sooner or later it will be ready for me to move to, but right now I’m back on Raring.

Tags : ,

Open a Terminal Window from Nautilus Menus

Because I like to do a lot of things by the command line, I often need to open a terminal window, which is nice and fast using the keyboard shortcut:

Ctrl+Alt+T

That opens the terminal window with the current working directory set to my Home folder. Usually this is fine, if you’re going to be doing something that doesn’t care what your current folder is, like running top. but if you want to do something quickly at the CLI in the folder that you have just browsed to in Nautilus, you have to manually CD to that folder in the terminal window before you can start to work there.

What would be really nice would be the ability to right-click on a folder (or on the background of the file window) in Nautilus and to be able to select an ‘Open a Terminal Window Here’ option from the context menu.

This shows you how to do just that. First of all, open a terminal window with Ctrl+Alt+T, and type the following:

sudo apt-get install nautilus-open-terminal

Once that has finished installing, close all Nautilus windows and then force a reset of Nautilus:

nautilus -q

Now ehen you right-click on a folder or in the background of the file window, you’ll see a context menu with an entry that says ‘Open in Terminal’. Selecting that option will open a terminal window with the current working directory set to the location you clicked on. Perfect.

Note that the context menus are slightly different depending where in Nautilus you clicked.

Folder Context Menu
Folder Context Menu
File Window Background Menu
File Window Background Menu
Tags : ,

Command Line Networking Tools

I’ve been using a pair of Raspberry Pi credit card sized computers to set up a basic Network Attached Storage device (NAS) and an XBMC media centre. I bought my Pi’s and cases from ModMyPi.

One Pi is running the standard Raspbian Wheezy Debian image with a large externally powered USB drive connected to it. This forms the NAS storage device. It has some Samba SMB shares set up on it. This means the shares are acessible from other computers on the same network. I can therefore back up to the USB drive on the NAS Pi and transfer media files to it.

The other Pi, the XBMC Pi, which is running Xbian, can access the Samba shares as media sources. Xbian is a stripped-down distro that boots straight to XBMC.

There are any number of tutorials on the web on how to do all of this, so I’m not going to rehash what has already been done elsewhere. But, because the XBMC Pi is connected to a wireless dongle (both systems are running headless, and I ssh onto them) I had to track down a few CLI networking commands to help me sort all of this out. I had a feeling that they might prove useful to others.

Of course, everyone knows about ifconfig. This enumerates the network interfaces and prints out a set of useful information about each one.

ifconfig

ifconfig

Another similar command is iwconfig. This concentrates on the wireless network interfaces and provides a different set of information.

iwconfig

iwconfig

To find your IP address quickly use ip addr.

ip addr

ip_addr

Another useful command to have up your sleeve is findsmb. This enumerates Samba shares on your network. The screenshot below was taken from my laptop in a public library, so there is not much information displayed in it. More details of this command can be found at the Samba.org website. It also shows example output.

findsmb

findsmb

Tags : , ,

Skype and a cheap Tesco Webcam

My niece is going to be working over seas for a while. I was asked to set up Skype on her Mum’s Kindle HD, and I put it on my wife’s and my own Android handsets. Being in the mood for global coverage, I also installed and configured it on my wife’s Nexus 7 tablet and her Windows 7 PC.

I then turned to my Ubuntu box (and put the bad thoughts of installing anything to do with Microsoft on my Linux box out of my head). Not having any real need for a webcam apart from this purpose, and a low-specced device being sufficient for my purposes, I bought a Tesco own-brand model. The store was handy and it was cheap. At £7.00 you can’t expect the Earth, and I didn’t hope for any more than a functional, cheap and cheerful camera. Which is lucky, because that’s exactly what it was. We’re talking no frills whatsoever.

To install Skype you must add the following repository, and then install Skype. In a terminal window, do the following:

sudo add-apt-repository “deb http://archive.canonical.com/ $(lsb_release -sc) partner”
sudo apt-get update && sudo apt-get install skype

With Skype installed I was able to enter my credentials and get on-line, but the webcam wasn’t being recognised. I Googled a bit and found some advice on the subject. Again at the command line, I had to perform the following steps to make sure I had the correct Video4Linux drivers installed:

sudo apt-get install libv4l-0

Once the drivers were installed, I installed a little application called Cheese, as a test. Skype doesn’t need Cheese, but I thought if I could get the camera working in another application it would let me know if the issue was related to the webcam or to the settings in Skype. I did this to install Cheese:

sudo apt-get install cheese

Cheese worked with the webcam without issue, so it was something to do with Skype. More Googling turned up more help. There are drivers that need to be pre-loaded before Skype is fired up. Specifically, these Video4Linux drivers need to be loaded: v4l1compat.so.

At the command line I did the following to see where the drivers were located on my hard disk:

locate v4l1compat.so

I made a note of the path that was returned, which in my case was: /usr/lib/i386-linux-gnu/libv4l/v4l1compat.so.

I needed to make a script to load these libraries, and then to load Skype. Back at the command line, I did the following:

sudo gedit /usr/local/bin/skype

and then entered the following two lines into the file:

#!/bin/bash
LD_PRELOAD=/usr/lib/i386-linux-gnu/libv4l/v4l1compat.so /usr/bin/skype

Once that was saved I added the following line to my .bash_aliases file (which is where I keep all my aliases; you could add it to your .bashrc file if you hold your aliases in there):

alias sk=’/usr/local/bin/skype &’

Now I can type sk and hit enter and Skype loads and runs and the camera works just fine.

Tags : , ,

Find Out the Version of Ubuntu

Here’s a fast way to find out the version of Ubuntu.

Open a Terminal window (keyboard shortcut: Ctrl+Alt+T), and then enter the following command:

lsb_release -a

And you’ll see some output like this:

Example output of the command,.
Example output of finding the Ubuntu version