Use SSH config file to easely connect to servers via alias names

I don’t have a very good memory and always have problems remembering my servers names when connecting to them via SSH. I usually used this “solution”:

$ history | grep ssh

Yep… not very neat. A friend (follow him, you’ll learn lots of things!) told me I could use Control+Shift+R in the terminal and It was like “OMG! This is great!”. After pressing that key combination you can start typing a command and you’ll get matches to previous commands with that text, so all I had to do was type “ssh” and then press enter. Magic!


But today I found another way that involved using the ~/.ssh/config file. The first step is to create this file in the correct place and, most important, with the correct permissions:

$ touch ~/.ssh/config
$ chmod 600 ~/.ssh/config

Now lets suppose we usually connect to a server called with a user named myuser. We can add this to ~/.ssh/config:

Host vps1
  User myuser

And here comes the cool part: now we can connect to this server with that user name by just typing this:

$ ssh vps1

That’s it. And of course you can add more and more configurations to it:


And if we also have enabled the connection using public/private keys we don’t even have to write a password.

This file is very heplful for other things too. For example you can make speed up SSH if you configure ControlMaster because it enables the sharing of multiple sessions over a single network connection.

Host *
  ControlMaster auto
  ControlPath ~/.ssh/ssh_mux_%h_%p_%r

If you get this error while connecting after configuring this it’s very likely because the ControlPath route does not exists or is write protected:

muxserver_listen bind(): No such file or directory


Enable hosting files outside /var/www in Apache2

I’m using Ubuntu and Mac OS X in my computer. I wanted both to share a partition to put all the things that could be duplicated in both systems: DropBox, downloads, music, etc. The websites I’m developing would be also there but I was getting 403 errors all the time. Anything outside /var/www won’t work. Finally I found out that there is a Directory configuration in /etc/apache2/apache2.conf that denies access to anything outside /var/www and /usr/share:

<Directory />
       Options FollowSymLinks
       AllowOverride None
       Require all denied

<Directory /usr/share>
        AllowOverride None
        Require all granted

<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted

To fix this you can disable the first Directory block or even better add a new one with Require all granted in it for your speceific path:

<Directory /home/shared/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted


Byobu: the text-based window manager and terminal multiplexer

Byobu is a text-based window manager and terminal multiplexer. This video is a great overview and tutorial on what it can do:

Install in Ubuntu:

$ sudo apt-get install byobu

Install in Mac OS X with brew:

$ brew install byobu

Install in Mac OS X with macports:

$ sudo port install python27 gettext libnewt coreutils gsed
$ curl -L -O
$ tar xzpf byobu_5.91.orig.tar.gz
$ cd byobu-5.91
$ ./configure
$ make
$ sudo make install



Generate a file with current Xorg server configuration

Run from a terminal this command:

$ sudo X :2 -configure

It’ll create a file in current users home folder called with all the configuration used at that moment by the Xorg server.



Changing rEFInd options

If you use rEFInd to boot multiple operating systems in a Mac you may want to change it’s options. For example the default 20 second timeout, in my opinion too long.


Booting from Mac OS X you’ll have to mount the rEFInd partition. You can see which partition it is in with this command:

$ diskutil list | grep EFI
   1:                        EFI EFI                     209.7 MB   disk0s1

Now that we know it is in disk0s1 we mount it:

$ mkdir /Volumes/temp
$ diskutil mount -mountPoint /Volumes/temp /dev/disk0s1 

The main configuration file can be found in /Volumes/temp/EFI/refind/refind.conf. Here you can change for example the timeout or the deault menu selection (by default rEFInd remembers the last selected one):

timeout 5
default_selection 1

Once we change everything we want just unmout the partition:

$ diskutil unmount /dev/disk1s0