How to fix “Unprotected Private Key File!”-errors when trying to connect to a EC2 machine

Most Amazon EC2-users run in the to pesky “Permissions XXXX for ‘xxx.pem’ are too open. It is required that your private key files are NOT accessible by others.”-problem from time to time. And the solution is surprisingly simple.

Since you are trying to access a machine using a private key, SSH requires that this key is only readable by the current user. This is to ensure that no-one else on the system can access this file and use it.

Simply change the permission of the .pem file to 400, which means that it’s only accessible by your user and the problem will be fixed:

chmod 400 xxx.pem

Getting the PHP runtime for App Engine to run on Ubuntu

AppEngine + PHPExciting news out of Google I/O 2013 reveals PHP support on Google AppEngine. As a php and a appengine-nerd, this is great news. And setting up the local development environment on Ubuntu (13.04) was a breeze.

The PHP runtime for AppEngine requires the cgi-version of php 5.4 (and above) and python  2.7 (and above). Most Ubuntu-installations have python installed, but i’ll cover those steps as well, feel free to skip those if they are redundant for you.

Installing Python

sudo apt-get install python

Installing php5-cgi
(this should be safe to install even if you currently have a php-version installed since it’s the cgi version)

sudo apt-get install php5-cgi

Grabbing the AppEngine for PHP SDK


Starting a local AppEngine instance using php5-cgi

./ /path/to/your/app –php_executable_path=/usr/bin/php5-cgi

Your app should now be serving on http://localhost:8080/.

More details can be found in the official documentation:

How to re-enable workspaces on Ubuntu 13.04 Raring Ringtail

enableworkspacesCanonical (the makers of Ubuntu) decided to remove the highly useful workspaces on default Ubuntu installations. But have no fear, this guide re-enables the workspaces within a minute or so.

It’s actually a lot easier than i thought, so ignore below and just open Settings -> Appearance and click on Behavior. Now you can re-enable workspaces with the “Enable Workspaces”-checkbox.

I’ve also updated the screenshot to better illustrate this.


First off we need to install unity-tweak-tool, either click on the link or type in the following commands in a Terminal (Ctrl + Alt + T)

sudo apt-get install unity-tweak-tool

Now open unity-tweak-tool using the Terminal:


In the window, click the “Workspace Settings”-icon (check the picture above) and flip “Workspace Switcher” to “On”.

Workspaces have now been re-enabled on your machine and it’s a persistent settings, so you don’t need to redo this if you reboot your machine.

How to fix Unity And Compiz not showing after Ubuntu 13.04 upgrade

Ubuntu 13.04 Raring RingtailAfter upgrading my installation of 12.10 Quantal Quetzal to Ubuntu 13.04 raring ringtail Unity decided to go in to hiding mode. Not sure why this happened, but resetting Unity And Compiz solved the issue for me.

Resetting Unity and Compiz is exactly what it sounds like. It will reset all customizations and configurations you’ve done to Unity and Compiz. So make sure that you backup any settings you wish to keep. Your mileage may vary.

Before resetting we need to install dconf-tools on your machine:

sudo apt-get install dconf-tools

Now run the following command to reset Unity and Compiz:

dconf reset -f /org/compiz/

All you need to do now is to logout and login and Unity should re-appear on you brand spanking fresh version of Ubuntu. Enjoy!

Getting Nvidia-drivers to work on Ubuntu 12.10 – Quantal Quetzal

After installing Ubuntu 12.10 Quantal Quetzal on my development-machine i noticed that i wasn’t running on the Nvidia drivers for my GeForce GTX 560 Ti. And to make matters worse, the proprietary drivers didn’t work either. So i set out on a Google-hunt to find myself a solution.

It seems like there currently is a bug in 12.10 which caused the Nvidia drivers to fail. Regardless for which repository (ppa:xorg-edgers/ppa etc) you’re using and if you’re using the latest version (304.32).

Problems seem to be within the kernel, so you need to install the generic kernel including its headers. Then remove the current Nvidia-drivers and re-install them. Sounds complicated? It’s not, just run the commands below and reboot.

Edit: Notice that you need to do this each time there is a new kernel upgrade in Ubuntu. So currently you should replace linux-headers-3.5.0-17-generic with linux-headers-3.5.0-25-generic in the instructions below.

Jump over to a terminal
Ctrl-Alt-F1 and login as your username.

Install linux source and headers, make sure to use the current kernel version 
sudo apt-get install linux-source
sudo apt-get install linux-headers-3.5.0-17-generic

Uninstall nvidia driver
sudo apt-get remove nvidia-*

Reinstall nvidia driver
sudo apt-get install nvidia-current-updates

If it successfully installs, restart the computer
sudo shutdown -r now

This solved my problems with my GeForce GTX 560 Ti and i’m now running 12.10 in full GPU acceleration.


Changing font-size in Ubuntu 12.10 without MyUnity

Since MyUnity isn’t available yet in Ubuntu 12.10 Quantal Quetzal i though i’d write a quick update to my previous post which isn’t working on Ubuntu 12.10.

The process is fairly simple, just run the command below and adjust them to whatever your preferred settings are.

Just keep in mind to double-check that the fonts you’re using are indeed install. Otherwise you’ll end up in a world of hurt when you reboot.

gsettings set org.gnome.nautilus.desktop font "Ubuntu 10"
gsettings set org.gnome.desktop.wm.preferences titlebar-font "Ubuntu Bold 10"
gsettings set org.gnome.desktop.interface document-font-name "Ubuntu 10"
gsettings set org.gnome.desktop.interface font-name "Ubuntu 10"
gsettings set org.gnome.desktop.interface monospace-font-name "Ubuntu Mono 11"

Changing the default font-size on Ubuntu 12.04

Are you like me and feel a bit overwhelmed by the default massive font-size in Ubuntu? Well, if you’re on Ubuntu 12.04 you’re in luck. Since there is a really easy way to change this setting.

Luckly and thanks to some helpful individual we have MyUnity. MyUnity is a simple little tool that let you tweek most of Unity in 12.04 without having to install gnome-tweak-tool. The usage is really straightforward and it’ll have you customizing Ubuntu in no time.

This is how my default Ubuntu 12.04 looked like:

Changing the font using MyUnity:

And the result:

It seems like this tool only work with 12.04 and older, so please read the appropriate documentation if you try and use it on a Ubuntu version below this. Also, i strongly recommend that you reboot your machine after doing the settings.

Good luck and happy Ubuntu-ing!

How to get local files working with Ubuntu 11.10 and Spotify

Running in to the pesky “no codec found” when trying to play your local mp3 files in Spotify when you’re on a freshly installed Ubuntu 11.10? The problem is that Ubuntu recently changed the Qt media backend from libavcodec to gstreamer. While gstreamer plays (decodes) mp3-files just fine, Spotify wont have any of it. 

The solution is to manually add/install libavformat, libavutil and libavcodec52 from the previous Ubuntu version. Please notice that you need different set of files for the 32-bit and 64 bit version.

32-bit Ubuntu:



sudo dpkg -i libavutil50_0.6.2-1ubuntu1.1_i386.deb && sudo dpkg -i libavcodec52_0.6.2-1ubuntu1.1_i386.deb && sudo dpkg -i libavformat52_0.6.2-1ubuntu1.1_i386.deb

64-bit Ubuntu:



sudo dpkg -i libavutil50_0.6.2-1ubuntu1.1_amd64.deb && sudo dpkg -i libavcodec52_0.6.2-1ubuntu1.1_amd64.deb && sudo dpkg -i libavformat52_0.6.2-1ubuntu1.1_amd64.deb

No Spotify-restart required, it just works ™.

Java 7 prevents FTP transfers on Windows when firewall is on

Experiencing problems with Java 7 and FTP transfers? You’re not alone since a nasty bug has slipped in to the seventh installment of Java and it’s causing major problems for its users.

The problem consists of the FTP command PORT in conjunction with Windows Firewall on Windows Vista and Windows 7. The firewall simply closed this connection which close the socket and the ftp-transfer fails.

This problem is especially troublesome for web developers that are using the java powered IDEs Eclipse and Netbeans. Since a simple upgrade to Java 7 will immediately cause the ftp transfers to stop working and the only remedy is to either close down (turn off) your firewall or downgrade to Java 6. Explicitly allowing the Javaw.exe process through the firewall did not solve the issue for me.

Oracle has been alerted of the issue on the 11th of August 2011, but unfortunately gave the bug a 4-Low in priority, which probably means that they don’t see the magnitude of the problem and we won’t see a fix for this issue anytime soon.

Installing Zend Server Community Edition (CE) on Ubuntu 10.04.3 LTS

Looking for a fast, reliable and easy PHP stack on Ubuntu? Look no further, the Zend Server is probably what you’re looking for. And if you’re developing your PHP apps in Zend Framework it’s a no brainer.

I’ve been through most of the different stacks out there including doing the complete LAMP-installation from scratch. Maintenance is troublesome and configuration (and lack of personal configuration-documentation) makes most of my installations unmanageable after a year or so. Until i found Zend Server, especially the Community Edition which is a completely free PHP stack backed and built by the people over at Zend Technologies Ltd.

If you’ve ever looked into different PHP frameworks you’ve probably stumbled over Zend Framework, which ties in extremely well with the Zend Server. So if you’re developing PHP apps using Zend Framework, the Zend Server will make your life a lot easier.

Zend Server is a pre-integrated PHP application stack including the most up to date setup and configuration for your server (VPS, Amazon AMI etc). It includes Bytecode accelerator (Optimizer+), Zend Data Cache, A certified PHP distribution, Zend Framework, Apache (or IIS integration), Out-of-the-box connectivity to all common databases, Java code connectivity and a Web-based PHP administrator console.

I recently setup another Ubuntu Server with Zend Server CE and thought i’d quickly run through the various commands you need to be up and running within no-time.

I strongly recommend that you install this on a fresh server since Zend Server is preconfigured with webservers, databases, php etc out of the box. If you already have Apache, PHP etc installed on your machine you’re probably going to run into trouble. Also please keep in mind that you need to have sudo-access for this.

Installing Zend Server Community Edition (CE) on Ubuntu 10.04.3 LTS

Start by adding the official Zend debs to your distribution.
sudo nano /etc/apt/sources.list

And the following snipplet in the bottom of the file
deb server non-free

Add the Zend’s repository public key
wget -O- | sudo apt-key add -

Now synchronize the repositories
sudo apt-get update

Finally install Zend Server with PHP 5.3
sudo apt-get install zend-server-ce-php-5.3

All done, you now have Zend Server Community Edition installed!

You can access your installation via https://localhost:10082/ZendServer (secure) or http://localhost:10081/ZendServer. If you cannot access your server via a browser on localhost, just replace localhost with either the servers public IP or a domainname.

From here on there are millions of opportunities, but i’ll try and cover those in another guide. Good luck and happy coding!

More information and links:
Zend Server Community Edition
Zend Framework
Zend Technologies Ltd.