Technology

Proftpd Without UNIX Users on Debian

Posted in Guides, Technology on February 1st, 2009 by thomasp – 1 Comment

So how do I setup a Proftpd FTP server on Debian without the hassle of using UNIX accounts for users of my server“, you might ask. “Brilliant question” I might respond. For the sake of clarity however, here follow what information I’ve been able to piece together during the last few units of time.

Before we go into detail on how it’s actually done, let’s take some time to reflect upon what we shall expect of this server:

  • No need for having UNIX users in order to log in
  • In particular do not allow UNIX users to log in
  • Jail users into their home directory
  • Make delicious coffee

First become root with

su

or

sudo su

if you’re on a weird system (e.g. Ubuntu).

Fetch the package typing

apt-get install proftpd

The installer will ask you if you whether you want it to run on top of inetd or as a standalone service. Choose standalone because the other is rubbish or at least not very good (thank God this is a blog, so I don’t have to justify my opinions!).

Editing the Configuration File

Next up is the configuration. I won’t go into irrelevant features such as virtual hosts, but if that’s what you want you’d best check out the example configurations at the official site. They’re actually pretty explanatory.

Start editing the configuration file using your editor of choice. This example features emacs.

emacs /etc/proftpd/proftpd.conf

The order in which the following is written is not important. It is important though, that it does NOT get stuck inside any XMLish tags such as …

This is what my /etc/proftpd/proftpd.conf includes:

# enable virtual users' shell to be /bin/false
RequireValidShell off
# disable logins from UNIX users.
# to enable UNIX users too,
# add mod_unix.c to the space-separated list
AuthOrder mod_auth_file.c
# auth files
AuthUserFile /etc/proftpd/ftpd.passwd
AuthGroupFile /etc/proftpd/ftpd.group
# jail the users in their home directories
DefaultRoot ~

The alert user instantly notices the files /etc/proftpd/ftpd.passwd and /etc/proftpd/ftpd.group. They are the virtual user equivalent of /etc/passwd and /etc/group which are the files Proftpd would have used had we not told it otherwise. Other than the fact that they share the exact same format, they are in no way connected in our setup. Proftpd doesn’t know about any other password/group files than the two specified in the new configuration file.

Creating the ftpd.passwd file

If you’re not into editing the ftpd.passwd by hand, you can use the ftpasswd script made available from http://www.castaglia.org/proftpd/. At the time of writing it can be obtained using

wget http://www.castaglia.org/proftpd/contrib/ftpasswd

It is a Perl script. First make it executable

chmod +x ftpasswd

The usage example featured here has will make a user with the username ‘john‘ with user id ‘1‘ and group id ‘1‘, having a disabled shell and save this user to the /etc/proftpd/ftpd.passwd password file.

./ftpasswd --passwd --file=/etc/proftpd/ftpd.passwd --name=john --uid=1 --gid=1 --home=/home/ftp --shell=/bin/false

The next user should have a different id (e.g. ‘2′).

To allow users to modify files you can choose to make it writable by any user of the system. Recall however that you’ve already jailed each user to his/her home directory, so the damage potential is rather limited. My example uses the /home/ftp folder as the home dir, so let’s remove the restrictions on that directory.

chmod 777 /home/ftp

Now all that’s left to do is restarting the server.

/etc/init.d/proftpd restart

If you’ve read this far I really hope it’s working for you! If not or if you have rants/comments about this guide, feel free to vent in the comments-section.

Subversion on Debian 4.0 “Etch”

Posted in Technology on January 27th, 2009 by thomasp – Be the first to comment

It sounds like a simple task, and it is. There are three ways of making Subversion repositories available:

  1. HTTP/DAV
  2. svn+ssh
  3. svnserve

On my server I’ve chosen svnserve since (1) HTTP/DAV is just too heavy for my limited purpose and svn+ssh requires me to add UNIX users for every user of my repository. svnserve on the other hand is really simple to setup, and it doesn’t require any additional software such as an Apache web server.

First we need Subversion:

apt-get install subversion

This package includes svnserve, so naturally we’re ecstatically joyous already. Incidentally I like having my Subversion repositories situated in /var/svn/, so let’s create a repository here.

svnadmin create /var/svn/MyRepository

Next up is the configuration. We start by editing svnserve.conf using some text editor capable of editing. Personally I prefer emacs for this task.

emacs /var/svn/MyRepository/conf/svnserve.conf

This is what it could look like.
[general]
anon-access = none
auth-access = write
password-db = passwd
realm = MyRepository

Line three (password-db = passwd) requires follow-up, since it says we’ll be using a password file called passwd.

emacs /var/svn/MyRepository/conf/passwd

My preferred token name is “john” and his password is “secret” apparently.
[users]
john = secret

All that is left to do is starting svnserve.

svnserve -d --listen-host example.com -r /var/svn

This will start svnserve in daemon mode (-d) with /var/svn as its root (-r). Thus MyRepository will be accessible via

svn://example.com/MyRepository

using the username john and the password secret. As it happens any other repository situated in /var/svn/* will also be accessible via the svnserve daemon.

Managing Huge Music Collections: Power Tools

Posted in Technology on January 11th, 2009 by thomasp – Be the first to comment

Directory Structure and File Name Layout

I prefer to keep my audio files named as such:

Artist/Album/01 Name of Song.mp3

Achieving a consistent naming scheme requires either loads of time and patience or a genuine power tool. I have found that Bulk Rename Utility is a indispensable tool for almost any file naming job, and it is thus highly recommended.

ID3 Tag Editing Including Album Cover Embedding

With regards to ID3 tag editing there are two excellent choices: Foobar2000 and Mp3tag. I do prefer the former, but only for the somewhat easier navigation. Foobar2000 does however not support album cover embedding. This concept enables JPEG images to be embedded in the ID3 tag of MP3 audio files, and is supported by Mp3tag.

It is even possible to automate the embedding if album covers if they reside in the folders of the albums. Suppose each cover is named folder.jpg. Drag all relevant folders into Mp3tag, select all the files and press Shift+Alt+5. Select Import Cover From File and type folder.jpg as the format string. The album covers are then automatically embedded in each audio file.

Using Foobar2000 for ID3 tag editing (Alt+Enter or right click followed by Properties) enables one to make use of the magnificent Automatically Fill Values feature. If for instance one’s naming scheme for files is the track number followed by a single space followed by the title of the track, then this pattern will fill those exact values correctly:

%TRACKNUMBER% %TITLE%

Conversion Between All Sorts of Formats

If one wish to convert massive amounts of audio files from one format to another Foobar2000 is the way to go. Like everything else in Foobar2000 converting is really easy. Just import the audio files, select them, right click and choose Convert followed by Convert to Same Folder (for convenience). If you want a file naming scheme that is not retarded you can choose More Settings and insert

[%tracknumber% ]%title%

into the Single tracks field.

Managing Huge Music Collections: Formats & Players

Posted in Technology on January 11th, 2009 by thomasp – Be the first to comment

About Formats

The truth is there is no truth. If however one wish to bet on the winning horse, then MP3 is definitely the format of choice. Although MP3 is a lossy format and thus degrades the quality of your precious and costly CDs, it is still the most widely used and therefore supported by virtually all hardware- and software players out there.

Another possibility is to use FLAC. This stands for free lossless audio codec and so it is. However it is not supported by the major players including iTunes and iPods which make it good for nothing but storing your CDs on the computer for later conversion. With an acceptable compression level FLAC will take up half the space on the hard drive as uncompressed WAV files do. It is comparable to having the negatives from a film lying around for later development in whatever size suitable, which I find very settling given the perishability of compact discs.

The alert reader will notice that both the lossy and the lossless format I have highlighted here are in fact technologically inferiors. Monkey’s Audio is a technically better format than FLAC, and Ogg Vorbis beats MP3 when it comes to compression rates. Why then still highlight FLAC and MP3? Because availability is the only thing that is really important when it comes to formats. If my iPod (hypothetical remark, I don’t own Apple equipment) does not play Ogg Vorbis, then it isn’t really better than MP3 since it doesn’t work.

About Software Players

Over the time I have used a lot of different software players, because no one player had just what I thought I was looking for.

Foobar2000 (Windows)

As far as I am aware this is the most customisable audio player out there. All this flexibility however, comes the price of work on your part. Gradually as my needs changed I found it to be rather tedious having to invest a lot of time changing the player too. The player features

  • An excellent ID3 tag editor for editing massive amounts of audio files
  • An unrivalled conversion tool for converting FLAC into MP3 or WAV into FLAC
  • Support for every interesting format
  • Doesn’t try to do everything for you

SongBird / iTunes (Windows)

I am mentioning these two players in the same heading since they are very similar to my mind in their workings. The main difference I find is that SongBird is open source. As opposed to Foobar2000 these players are not very customisable but requires one to setup everything in a certain maner. They assume that their users are numbskulls which ironically means that it’s harder to figure out how to use them reasonably than Foobar2000 or WinAmp for instance. The features of these players include

  • Looking good without too much work
  • Feels finished (applies especially to iTunes)
  • Easily navigated by friends who are not necessarily very tech savvy

Managing Huge Music Collections: Overview

Posted in Technology on January 11th, 2009 by thomasp – Be the first to comment

At the time of writing most young people I know have quite large collections of music on their computers. Whether or not these collections are well organised is unknown to me. However, looking at my own collection as it appeared just a few days ago I am lead to believe that the answer to this question is: they’re quite disorganised.

Organisation of music collections include the following:

  • Naming conventions should be laid out and followed. This goes for directory structure and names of the music files
  • ID3-tag information should include some basic information about the track that corresponds to the name and path of the music files
  • Cover Art should be included such that the player can find it

Preferably some extra bits of goody-goody attributes also apply:

  • All the files in the collection share a common format such as MP3 or FLAC

So what do I do about it?

Over the next couple of articles I am going to discuss some of the power tools that get the job of managing a huge music collection done. Furthermore I will talk about why MP3 isn’t such a bad format after all, and a little about what the different software players can do.