March 22, 2011

Installing Lsync on Ubuntu 9.10 / 10.04

Filed under: Uncategorized — Tags: — yasi8h @ 9:12 am

If you want to seamlessly sync two folders across two machines on the internet, you could use a lot of tools for the like sync. However if you want this syncing to take place whenever a file changes in the master (in a case where you have a master and a slave, where masters changes are propagated to slave), you can use Lsync. You can read more about it here (

Here is how to get it installed on Ubuntu. This has been tested on version 9.10 and 10.04.

Download the latest version of synced

Install the required packages
sudo aptitude install lua5.1 liblua5.1-0-dev pkg-config

Compile and install away
cd lsyncd-2.0.3
sudo make install

Test whether its installed
lsyncd -version

Thats it!


March 17, 2011

Facebook Connect, Cookies, Nginx and 400 Bad Request Errors

Filed under: Uncategorized — Tags: , — yasi8h @ 10:15 am

One of my colleagues were having a problem with getting Facebook connect to work in one of his rails apps. The strange thing was that it worked fine on his local. But when he uploaded the app to staging (which was a standard nginx/passenger/mysql/ubuntu stack), he would get a weird 400 Bad Request error after authentication and redirection from Facebook.

After googling around for a while it turned out that nginx has a limit on the request header size.

“maximum number and size of buffers for large headers to read from client request.” – from nginx documentation (

Increasing this solved the problem.

The current setting is at large_client_header_buffers 4 8k and it seems to work fine so far.

March 7, 2011

Basic Ubuntu 10.04 Server Setup Guide

Filed under: Uncategorized — Tags: , — yasi8h @ 2:56 am

There are some basic steps i do when setting up a fresh server (ahh sounds so good! :D). Going to list them out so i can follow them and have no problems forgetting anything in the future.

  • Add a user : adduser foobar
    • answer all the question asked
  • Add your public key to the authorized_keys so you can ssh in without password authentication (with public key authentication).
    • login as the new user
    • mkdir .ssh
    • nano .ssh/authorized_keys
    • put your public key in and save the file (ctrl + o, ctrl + x)
  • Add a entry for the new server in your .ssh/config for easy access to it from your local
    • nano .ssh/config
    • add a entry like this (please ignore the bullet points)
      • Host whatever_fancy_name #you will use this on your local ie: ssh whatever_fancy_name
      • User=foobar #user name on the server
      • Hostname= #your server ip
    • save the file (ctrl + o, ctrl + x)
  • Setup sudo without been asked for the password for the new user
    • visudo
    • add this line to the bottom: foobar ALL=(ALL) NOPASSWD:ALL #foobar is the username, while nopassword tells sudo not to ask the user for his password when using sudo
  • Disable remote root logins for sshd
    • sudo nano /etc/ssh/sshd_config
    • find the line ‘PermitRootLogin yes’ and replace it with ‘PermitRootLogin no’
    • save the file (ctrl + o, ctrl + x)
    • restart sshd
      • sudo /etc/init.d/ssh restart
  • Some default packages you might want to setup
    • htop (sudo aptitude install htop)


Blog at