Categories
Computers Linux

Install Pure-ftpd

pure-ftpd icon

It should be very simple to set up an FTP server on a Linux server but for some reason I always seem to have an issue with it. The first question is which daemon to install when there are so many. The main three contenders seem to be pure-ftpd, proftpd and vsftpd but even choosing between them can be daunting.

Many (if not all) FTP servers seem to have been written with the intent to either providing FTP access for people with shell accounts on the FTP server or for anonymous users. I have no interest in anonymous access and the only one with local account that need file access is myself and I much prefer to use scp via Cyberduck instead. So my requirement for a pure virtual FTP server is usually not mainstream and I invariably find myself lost in all configuration descriptions.

Here is a simple step for setting up pure-ftpd on a Debian system and add an account:

  • Install the server [apt-get install pure-ftpd]
  • Create an FTP group [groupadd ftp]
  • Create an FTP user [useradd -g ftp -d /dev/null -s /etc ftp]
  • Create a folder to hold the FTP data [mkdir /var/ftp]
  • Change owner on the folder [chown ftp:ftp /var/ftp]
  • Add a pure-ftpd user [pure-pw useradd testuser -u ftp -d /var/ftp -N 300]
  • Save the changes [pure-pw mkdb]
  • Run the server [/usr/sbin/pure-ftpd -j -lpuredb:/etc/pure-ftpd/pureftpd.pdb &]

To start the server automatically, use xinetd and add the following to /etc/xinetd.d/ftp:

service ftp
{
socket_type = stream
server = /usr/sbin/pure-ftpd
server_args = -j -lpuredb:/etc/pure-ftpd/pureftpd.pdb
protocol = tcp
user = root
wait = no
disable = no
}

Then restart xinetd (/etc/init.d/xinetd restart).

Categories
Computers Mac

Riding the rails on Leopard

Mac OS X 10.5 comes with support for Ruby on Rails but the included releases were the stable releases at the time Leopard was frozen. Ruby hasn’t changed much but Rails has progressed quite a lot during that time. To make sure that your installation is up to date, do the following:

sudo gem update --system
sudo gem install rails
sudo gem update rake
sudo gem update sqlite3-ruby

This will (currently) bring your Rails version up to 2.0.2. Noteworthy changes to Rails 2.x include:

  • Sqlite3 is now the default database driver. MySQL is still available out of the box but sqlite3 makes it even quicker to set up a test project.
  • It is even more obvious that REST is preferred over SOAP for inter-machine communication under Rails.

For an extremely simple RoR solution, type this in the terminal:

$ rails TimeReport
$ cd TimeReport
$ script/generate scaffold project number:integer name:string
$ rake db:migrate
$ script/server

Then open your web browser and go to http://localhost:3000/projects. Congratulations, you have written your first Rails application.

Categories
Computers Linux

Ping utility with timestamping

Ping is no doubt one of the world’s most wide-spread applications. It is even so common that most people that use it probably don’t even know that they don’t actually “ping” the remote host. What they do is to send ICMP Echo requests and wait from replies.

Despite being great for what it does the standard GNU ping utility (or the Windows application for that matter) fails to record the time when the ping was sent and the output is in some quasi readable format that is not trivial to import into some application.

This Perl script wraps the Linux/UNIX form of the ping utility to output the sequence number and the round trip time as comma separated values. It also prepends each line with the current date and time so that the output can be imported into a spreadsheet to create a graph of the round trip time over time.

N.B. This perl script will not work on Windows since the output format differs from that on Linux/UNIX.

Attachments

Categories
Computers Linux

Installing Voyage Linux on ALIX 2c0

As I wrote earlier, I have bought myself an ALIX 2c0, a smallish embedded computer. It is designed and manufactured by PC Engines and has the following specification:

  • 433MHz AMD Geode CPU
  • 128MB RAM
  • Compact flash slot for storage
  • 2 mini-PCI slots for WiFi or other uses
  • One serial port that is uses as console but can be reconfigured (although limited in functionality

There are number of distributions that could be used on this system. I found Voyage Linux to be the most interesting since it includes the standard Debian package manager. This means that it is effortless to install additional applications.

To get Voyage Linux onto the ALIX I did this (using another computer running Linux):

  1. Download Voyage Linux 0.5.0 or later from the Voyage Linux web site
  2. Untar the archive [ tar –numeric-owner -jxvf voyage-0.5.0.tar.bz2 ]
  3. Change directory [ cd voyage-0.5.0 ]
  4. Create a directory where the compact flash disk can be mounted [ mkdir /mnt/voyage ]
  5. Insert the compact flash disk and check which device name it gets (N.B. be absolutely certain that you get this correct or you may end up wiping your hard drive) – This instruction assumes that the compact flash disk is /dev/sda
  6. Run the script [usr/local/sbin/format-cf.sh /dev/sda] within the downloaded and unzipped archive. This will initialise the compact flash disk – Again, please verify which device name corresponds to the compact flash disk on your system
  7. Run the script [usr/local/sbin/voyage.update]

The script will go through the installation and ask questions. Most of the options will be correct so it is mostly a matter of pressing enter a number of times. What you will want to change is the following:

  • The target profile should be set to “4 – ALIX” instead of “7 – WRAP” which is the default
  • The target disk should be set to whatever device is your compact flash disk (e.g. /dev/sda) – PLEASE check the correct device name on your system or risk wiping your hard drive, but on the other hand if you didn’t heed my warning earlier your disk is already toast.
  • The drive where the compact flash disk should be mounted should be set to the folder created above (e.g. /mnt/voyage)

At the end you will be faced with a summary of all the settings. Check that it is correct and then type “y” to continue. The copying will take a minute or two, after that the compact flash disk is ready. Just place it in the ALIX, connect it to your network and boot.

The system will automatically use DHCP to get an IP address. It can be reached by SSH with the default root password of “voyage”.

Categories
Computers Mac

Install wget on Mac OS X

Mac OS X comes without support for wget but this limitation is easily fixed. Start off by signing up to Apple Developer Connection and download XCode 3.0 – it’s a free but rather big download. Then open a terminal window and type:

ftp ftp://ftp.gnu.org/gnu/wget/wget-latest.tar.gz
tar -xvzf wget-latest.tar.gz
cd wget-{version}
./configure
make
sudo make install

Replace {version} with the version of wget that was downloaded (shown when unpacking the archive).

Categories
Computers Gadgets Linux

Ladies in red – ALIX & iPod Nano

I recently bought an ALIX 2C0 that goes very well to my iPod Nano. ALIX is an embedded hardware platform that can run a number of operating systems – many quite simple to work with. It is made by a Swiss company. Their previous models were called WRAP and I had one of those. The first impressions of this computer is that it is significantly faster than the model it replaces. The system is powered by a 433MHz AMD Geode processor and comes with 128MB RAM and a compact flash slot for storage. If that is not enough for you, there are 500MHz/256 models available. And despite the red colour it is quite friendly on the environment, drawing less than 5W.

Ladies in redALIX 2C0

Before you rush out and get this with the idea that it could replace your current desktop – hold your horses. The connector on the left is a serial port, not a display connector. This kind of computer is used to make routers or access points, not something you would run a desktop operating system on.

I haven’t fully figured out what I am going to use it for but I have some thoughts. I will get back to that, as well as a walk-through of installing a Linux distribution on it.

Categories
Computers Linux

Unicast to broadcast

Unicast to broadcast

Sometimes it might be beneficial to redistribute unicast UDP traffic to multiple other clients. I tried to accomplish this using iptables but it doesn’t seem to be able to resend the packets to the local broadcast address.

This program provides a solution to this problem. It listens on a specified UDP port on all local addresses and resends those packets to the local broadcast address. To avoid creating a loop the incoming and outgoing ports must be different. The application can also ensure that only packets coming from a specified source are being retransmitted. While the latter doesn’t provide any real security since it is trivial to spoof the source IP address, it does provide some immunity from other applications.

The source code for the application (uc2bc) is included in the gzipped archive below. Just compile with “gcc -o uc2bc uc2bc.c”. A sample init script is also included. This would go in the /etc/init.d folder.

Thanks to Andreas who got me (re)started with socket programming on *NIX.

Attachments

Categories
Computers Gadgets Music

Using iPod Touch as SqeezeCenter remote

I bought an iPod Touch a couple of months ago on the assumption that it would be an ideal remote control for my SlimServer setup. Unfortunately, there was no theme tailored for the screen size of the iPod Touch (or iPhone for that matter).

With the upgrade to SqueezeCenter, it is possible to add a theme called iPeng that is fantastic for the iPod Touch.

SqeezeCenter-iPeng

Suddenly, the iPod Touch is every bit the remote control I was hoping it would be. A big thanks to Joerg Schweider, aka Coolio.

Categories
Computers Linux Music

SqueezeCenter 7.0 is out!

Finally! I have been running SlimServer 6.5.4 for a long time and it was time for an upgrade but SqueezeCenter, the promised replacement for SlimServer, just never seemed to materalise. Sure, the development branch has been available for some time but for once I wanted to hold on until the real thing was out.

SqueezeCenter 7.0

And now it is here. Logitech released SqueezeCenter 7.0 yesterday. The upgrade from my previous installation of SlimServer 6.5.4 on Ubuntu 7.10 was very straightforward. I just did:

# apt-get update
# apt-get remove ––purge slimserver
# apt-get install squeezecenter

The effort is well worth it. I have just barely started using the new interface but it is much slicker and also feels a lot more responsive.

css.php