SSH over HTTP Proxy

Using SSH to connecting to an host when an HTTP Proxy is between the client and the host, can not be done directly without some configuration.

On Linux based machines the solution is to install and run corkscrew, a program that can tunnel the SSH protocol through an HTTP Proxy.

So how to do the configuration?

1) First install the corkscrew program with your package manager. On Ubuntu family: apt-get install corkscrew

2) Then you need to configure SSH to use corkscrew when connecting to the host that has a http proxy between.

3) Goto to your home directory and change to the hidden directoy .ssh within a command shell window.

4) Create or edit a file named config. The name is just config. No extensions.

5) Add the following lines to the config file

Host <IP_of _remote_host>  
 ProxyCommand corkscrew <IP_of_HTTP_Proxy> <HTTP_Proxy_Port> %h %p <auth_file>

Where the <IP_of_remote_host> is the public ip address of the host where you wish to connect.

The <IP_of_HTTP_Proxy> and <HTTP_Proxy_Port>  are the IP address and Port of you local http proxy server that you wish to go through.

And finally, if your proxy server requires authentication, by username and password, just give a complete path to a file where Proxy credentials are stored, for example /home/primalcortex/.corkscrew_auth

This file content must be something like:


For example a complete config file example:

    ProxyCommand 8080 %h %p /home/primalcortex/.corkscrew-auth

and the .corkscrew-auth file:


6) Just connect now:

ssh myremoteuser@

or when not using the default ssh port:

ssh -p 12345 myremoteuser@

7) Done!

So why we need this?

Well, first is of course, to access a remote machine, but ssh can forward local ports to remote ports, and this is important because, with this feature we can use Thunderbird to directly connect to a remote server by using the standard IMAP and SMTP protocols through an HTTP proxy.

MySQL on a Ubuntu VPS

Using the great site I’ve “bought” a Ubuntu based VPS (Virtual Private Server) so that I can use for my testings…

Anyway, I needed to install MySQL database on this Ubuntu Server based VPS, which is simply done by running the following command:

apt-get update
apt-get install mysql-client mysql-server

During the installation process a password for the root user is required. Just make sure that it’s strong enough (Hint: use keypass password generator…)

After installing and running the MySQL server is available at port 3306 and normally only available at the loopback address. But anyway I’ve changed the local firewall rules to block all connections to port 3306 from outside the loopback adapter: Just edit the /etc/rc.local file and add the following lines before the exit 0 command

iptables -A INPUT -p all -s localhost -d localhost -j ACCEPT
iptables -A INPUT -p tcp --destination-port 3306 -j REJECT

Then as the root user just run the file: /etc/rc.local and make sure that the rules are active:

root@vpss:~# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  localhost.localdomain  localhost.localdomain 
ACCEPT     all  --  localhost.localdomain  localhost.localdomain 
ACCEPT     all  --  localhost.localdomain  localhost.localdomain 
ACCEPT     all  --  localhost.localdomain  localhost.localdomain 
REJECT     tcp  --  anywhere             anywhere             tcp dpt:mysql reject-with icmp-port-unreachable
ACCEPT     all  --  localhost.localdomain  localhost.localdomain 
ACCEPT     all  --  localhost.localdomain  localhost.localdomain 
ACCEPT     all  --  localhost.localdomain  localhost.localdomain 
ACCEPT     all  --  localhost.localdomain  localhost.localdomain 
REJECT     tcp  --  anywhere             anywhere             tcp dpt:mysql reject-with icmp-port-unreachable

And that’s it.

Now we need a backup policy so that anything goes wrong, at least we have some data to recover…



Execute a simple Java Console application

How to execute a simple java console program, with a main function?

Sometimes whe need to build a simple java program to test some concept/code/whatever.

So the code is something like (grabbed from stackoverflow for my quick reference):

Sun’s tutorial contains a complete demonstration, but here’s another one from scratch. You need two files:

public class Test {

   public static void main(String[] args){
      System.out.println("Hello world");
Then create a file with the following content:

Manifest-version: 1.0
Main-Class: Test

Then compile the Java source file and create the jar file:

jar cfm test.jar Test.class
java -jar test.jar


Hello world

Synology Mail Station with POP3 retrieval – Hibernation issues

After installing and enabling Synology Mail Station (RoundCube), I added a POP3 external account, so that account’s mail also was available at RoundCube’s interface on my Synology.

The issue is that after that change/configuration the NAS didn’t hibernate any more.

I thought that the issue was related to the pooling interval to the POP3 account, and I was right, it was set to 5 minutes by default. I’ve changed to 4 hour’s (240 minutes), but checking the logs I could see that the pooling was still at 5 minutes… and still the NAS wouldn’t hibernate.

So a quick check I’ve found out that the fetchmail process that fetchs the mail from the external POP3 accounts reads it’s configuration files from /var/packages/MailStation/target/roundcubemail/ext

In my case the POP3 account was defined on the admin accounts, and so there is an admin_fetch file, which might be different if other users are using the POP3 external accounts feature.

Editing this file there is a line

#### .fetchmailrc
set daemon 300

Which means pooling every 5 minutes (300 seconds)

I’ve changed the value to 21600 (4 hours), and waited for the next NAS restart.

After that pooling was set to every 4 hours and the NAS does hibernate now.

Didn’t bother to much to see how to restart the fetchmail process without rebooting the NAS, but probably restarting the Mail Station packages will suffice.

How to check Apache Httpd version

This is a quick post regarding the how to check the Apache httpd version.

The simple way is just to run the following command: httpd -v

But on Linux, an error might crop up, namely: ./httpd: error while loading shared libraries: cannot open shared object file: No such file or directory

So solve this issue, just run first the following command on the sbin httpd instalation directory:  source envvars and then the httpd -v command should work ok.


[K]Ubuntu on the Asus N73SV video issues – i915, Nouveau, Nvidia and Bumblebee

Well, after a month on using this Asus Laptop N73SV there are some issues with it.

The first one, and I’m not sure if it’s a driver issue or just a plain hardware issue is that the external connected monitor was working fine, and then started to have a blue tint and now it has a green tint. So first I wonder if the VGA cable or the monitor itself was bad, but replacing it by another same monitor brand and model  and different VGA cable, it has shown the same issues. So Ok, it’s a laptop issue that some HP owners are also having… Just search for HP an video tint… Removing the battery and power, waiting some time, and booting up with the external monitor, even the ASUS logo is tinted… So it’s not a K/Ubuntu issue. Solution? None so far. I have to try with a different monitor/and cable namely HDMI.

The second part of this post related with the video issues that I have is due to the fact that this N73SV has dual cards: an Intel i915 and NVidia GT540M. While trying to debug the above issue, I ended up with no desktop effects on KDE KDM by messing around with the desktop effects options… Whatever I did to enable them I was also greeted with the message that Effects couldn’t be enabled. So issue was related to the fact that the GLX libraries couldn’t be found/loaded… When running glxgears this error appear:

name of display: :0.0
Xlib: extension “GLX” missing on display “:0.0″.
Xlib: extension “GLX” missing on display “:0.0″.

The solution:
I’ve removed bumblebee and nvidia, which cleared the issue:

apt-get purge bumblebee
sudo apt-get purge nvidia*
apt-get install –reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri xserver-xorg-core
dpkg-reconfigure xserver-xorg

And after this I could enable  again Desktop effects but I was using the default Intel driver and the Nouveau driver.

Finally, I’ve installed again MrMee/Bumblebee, which by itself installed again the Nvidia drivers, and after that I could only boot into Recovery Mode, because a normal start wouldn’t give me the Kubuntu boot logo and at final boot stage I just had a black screen with an hanged computer…

This issue is due to the fact that the nouveau driver is/was enabled, and I had to disable it. I found no complete instructions for doing that, but these do work:

The nouveau driver needs to be disabled, by editing two files:


Add at the end of this file the following line: blacklist nouveau

And then, the other file to edit it depends of your grub version. For Grub2 , there is the need to add the following to the file /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash pci=nomsi nouveau.blacklist=1

And then run the command: update-grub2

On Grub1, just edit the menu.lst file and add the nouveau.blacklist=1 to yur booting kernel options, keeping in mind that after a kernel upgrade you need to blacklist the module again.

Booting up now with the Intel Driver and the Nvidia driver installed by Bumblebee should work.

Portuguese Steam Engine train at the Douro

One of my favourite shows at the Travel Channel is the one named “The Great Scenic Railways Journeys”. North America has a lot of private and volunteer steam engines trains that are a tourist attraction, and at the same time, keep it’s pre-industrial and industrial history. And this on two countries that have at most 250 years of “modern” history.

Portugal despite it’s huge 1000 year history and contribution to the global world history is famous for  forgetting and letting rot it’s assets…

So it’s good to see, again this year, an old steam engine train on one of the more beautiful rail-roads in Europe and across the OPorto wine region is back in action:

If your in Oporto area this year, don’t miss it: Every Saturday until the 1st of October.

Kubuntu, Bumblebee upgrade and NVidia

Yesterday, I’ve upgraded bumblebee on my Asus N73SV, which by itself downloaded and installed a new version of the proprietary Nvidia driver.

During the upgrade process, I was asked to install the maintainer version or my version… and I kept my version.

So after rebooting, I had no Kubuntu splash screen, just a black screen and after a while it just computer just hang with a dead keyboard. So unbootable and only rebootable by pressing the power button several seconds.

After some fiddling around I found out that booting into safe mode, getting into a root shell and starting KDM, everything seemed to work fine.

To keep a long story short, at boot time the X server loaded the Nouveau driver, and it was failing (looping) with some strange IRQ error. So the computer hanged.

The solution: Goto System -> Additional Drivers and enable the NVidia driver.

Reboot, and everything is Ok: Splash screen and Kdm.

A good solution is probably to purge completely the Nouveau driver if you’re really want to use the Nvidia driver. Instructions here:

I reality this is the same issue with the ATI drivers. After upgrading the drivers it is, at least in my case, to explicitly enable them.

Arch Linux test drive: Thoughts from a Kubuntu user

My old work laptop computer is about to be replaced by my employer by a new ASUS N73SV.

First of all this computer has what is called the Optimus Graphics Technology, that isn’t so Optimus regarding Linux… This technology is made of two video cards, one Intel embebed on the chipset and one discrete Nvidia chipset. As far as I know there is no Linux driver for this, and Nvidia won’t be releasing in a foreseeable future Linux support. So the Intel card will be used (I’m not using this for games) and the Nvidia card will be disabled. There are solutions for disabling completely the card and or use some applications on the Intel card and others on the Nvidia card, I’ll have to check. But disabling the Nvidia card improves the battery life, so…

So, off course, the first thing to do this computer is to nuke the Windows 7 install and install a Linux OS…

And there’s the catch: Kubuntu 11.04 or the Arch Linux Rolling distro?

Both have great documentation and great communities, but both could have some “clean up” on it. For example, on the Arch Beginner Install, some things aren’t completely obvious (Well at least for me). This is due to the fact that the documentation is in fact complete, it shows all the possibilities, but it should only show first the most obvious/common/standard way, and then link out the complete documentation regarding the subject. This way documentation could be more slim and straight forward.

Anyway, I was able to install and get an Arch system running without any issues with KDE Desktop but there where issues, and those are not Arch Linux fault. These issues are related to it’s mirrors and the software and sync status of them.

So being on PT, I’ve enabled all PT mirrors, and ended up with KDE 4.4.5 installing and running… Well the latest release of KDE is 4.6.3, so what happened here??? Browsing the mirrors I’ve found out that some where not up to date, so I’ve disabled them, and sure, pacman now shows that KDE 4.6.3 is available. So I’ve disabled the out of date mirrors, and while downloading I had failures regarding mplayer, and x264 packages that wouldn’t allow the upgrade to proceed.

Humm, ok, so I’ve enabled the core repository, and now everything is downloaded fine, but pacman refuses to upgrade due to some packages are corrupted.

So, not of the best starts…

But still I’ll give Arch Linux a try, because mainly on Kubuntu to have the latest software version, namely Libreoffice and even Calligra for test driving means to add backports and probably broking your next mandatory upgrade.

So, after reading the Arch Linux Wiki, I’ve found out that there is a mirror status page that shows what mirrors are available and up to date. I’ve deleted my obsolete mirrors, and enabled only the “live” ones (one in my case and did a full upgrade, and after an hour, more or less I had KDE 4.6 SC installed and running.

So far what I’ve done:

- Installed the base Arch system, making sure that the mirror list was up to date.

- Configured a new no priviledge user, and set up sudo

- Installed Xorg and KDE

- Configured the dbus and kdm daemons to start automatically

Then, I want to install the KDE Kpackagekit, but this was only available on AUR, not on the mainstream repositories. I’ve followed the instructions on and installed yaourt package manager. From here I’ve installed Kpackagekit, and with it I was able to install through KDE the rest of packages that I wanted, namely  the kdeplasma network widgets.


Dokuwiki error

Quick post:

If by any chance, on Linux, you have the following error: The datadir (‘pages‘) does not exist, isn’t accessible or writable. You should check your config and permission settings.

The easiest way to check it is to do:

1) Goto root: sudo -s

2) Goto the web server user, normally www-data is the user used by Apache and lighttpd: su – www-data

4) Transverse the directory until reaching the pages directory: cd /; cd dir1; cd dir2 and so on

5) Somewhere when transversing the directories the permission error will pop-up when doing the cd command without enough privileges (the reason for the issue). To solve the issue, exit to the root user and correct the permissions to the user www-data on the affected directory.