I'm planing to write Unix 101 -- beginner for beginner. Since I started getting into shell much more than GUI, I liked how simple Unix is. However, I'm no pro as Unix user; Thus, I probably have an idea what Unix 101 should be like much more than reading through Unix manual indeed.

By the way, after trying Windows Server 2008 standard for a month or so, I found that there were too many hassles involved. It was good to have GUI or wizard to walk through but sometimes it just gave us more confuse. Believe it or not, I can't even get FTP server on IIS work properly :-( Although the alternative, like FileZilla server, works flawlessly, it's just not right using 3rd party while using server edition and that's already equipped with FTP server. It's just like using Apache HTTPd on Windows server; why just use IIS or just change to Linux box for good =)

So I choose to have less complicated way--Ubuntu. Well, the reason why I choose Ubuntu is nothing but easiest. In Ubuntu server 8.10, there is no ftpd by default for whatever reason. So adding one of them is a must. Because There are many many choices, I don't know what is good too. I just choose proftpd and I find that's easy to configure. That's simple.

Firstly, install it! -- remember this is Ubuntu--it's debian. Your distro might use something else, but that differs when installing only.

$ sudo apt-get install proftpd

Done with ftpd installation. That's easy, isn't it? Then we have to do configuration, briefly we have to:-

  1. manage user
  2. edit proftpd.conf
  3. start/restart proftpd

For managing user, you might use the same account in OS, so that you don't have to do a thing in this step, but if you want to use isolated user for extra security (?!?), go for it.

useradd [ -u uid ][ -g gid ][ -G gid [,gid,.. ]][ -d dir ][ -m ][ -s shell ][ -c comment ] loginname

You could just have only parameter you want, then the rest would be default value

$ sudo useradd -d /home/ftp ftpuser

$ sudo passwd ftpuser //for creating password for ftpuser

For configuring our ftpd, here is  the most important part--editing /etc/proftpd/proftpd.conf. In my case, I have login thru ssh, so no GUI no gedit no mousepad, nano is my first choice of text-editor here. You guys might us different one as you like.

$ sudo nano /etc/proftpd/proftpd.conf

what you need to configure basicly are the following:-

ServerName            "10nas" 
  ServerType            standalone 
  # Set the user & group server 
  # normally runs at. 
  User                nobody 
  Group                nogroup 
  # Set default root as a NAS 
  DefaultRoot /mnt/nas 
  # This is for keeping FTP user
  # inside DefaultRoot only! 
  DefaultRoot ~ 
  # Valid Logins 
  <Limit LOGIN> 
  AllowUser x1 
  AllowUser x2 
  AllowUser x3 
 AllowUser x4 
  DenyALL 
  </Limit> 
  MaxLoginAttempts 3 
  # well, <Directory> /mnt/nas> looks weird,
  # but it's not a typo! 
  <Directory> /mnt/nas/> 
  # This is basic security for initial 
  # file permission
  Umask 022 022 
  AllowOverwrite on 
      <Limit ALL> 
      Order Allow,Deny 
      AllowUser x1 
      AllowUser x2 
      AllowUser x3 
      AllowUser x4 
      Deny ALL 
      </Limit> 
  </Directory>

Commands to start/stop/restart the service is similar to any service

$ sudo /etc/init.d/proftpd start
$ sudo /etc/init.d/proftpd stop
$ sudo /etc/init.d/proftpd restart

Well, this should be enough for setting up basic FTP server securely. =)