You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

81 lines
4.4 KiB

10 years ago
---
layout: post
status: publish
published: true
title: How to configure ftpd -- proftpd
author:
display_name: ''
login: ''
email: ''
url: ''
wordpress_id: 337
wordpress_url: http://blog.10ninox.com/2008/11/23/how-to-configure-ftpd-proftpd/
date: '2008-11-23 20:37:03 +0700'
date_gmt: '2008-11-24 01:37:03 +0700'
categories:
- linux
tags: []
---
<p>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.</p>
<p>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 =)</p>
<p>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 <em>proftpd</em> and I find that's easy to configure. That's simple.</p>
<p>Firstly, install it! -- remember this is Ubuntu--it's debian. Your distro might use something else, but that differs when installing only.</p>
<p class="codebox">$ sudo apt-get install proftpd</p>
<p>Done with ftpd installation. That's easy, isn't it? Then we have to do configuration, briefly we have to:-</p>
<ol>
<li>manage user</li>
<li>edit proftpd.conf</li>
<li>start/restart proftpd</li>
</ol>
<p>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.</p>
<p class="codebox">useradd [ -u uid ][ -g gid ][ -G gid [,gid,.. ]][ -d dir ][ -m ][ -s shell ][ -c comment ] loginname</p>
<p>You could just have only parameter you want, then the rest would be default value</p>
<p class="codebox">$ sudo useradd -d /home/ftp ftpuser</p>
<p>$ sudo passwd ftpuser //for creating password for ftpuser</p>
<p>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.</p>
<p class="codebox">$ sudo nano /etc/proftpd/proftpd.conf</p>
<p>what you need to configure basicly are the following:-</p>
<pre name="code" class="c-sharp">
ServerName&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &quot;10nas&quot;
ServerType&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; standalone
# Set the user & group server
# normally runs at.
User&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; nobody
Group&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; nogroup
# Set default root as a NAS
DefaultRoot /mnt/nas
# This is for keeping FTP user
# inside DefaultRoot only!
DefaultRoot ~
# Valid Logins
&lt;Limit LOGIN&gt;
AllowUser x1
AllowUser x2
AllowUser x3
AllowUser x4
DenyALL
&lt;/Limit&gt;
MaxLoginAttempts 3
# well, &lt;Directory&gt; /mnt/nas&gt; looks weird,
# but it's not a typo!
&lt;Directory&gt; /mnt/nas/&gt;
# This is basic security for initial
# file permission
Umask 022 022
AllowOverwrite on
&#160;&#160;&#160; &lt;Limit ALL&gt;
&#160;&#160;&#160; Order Allow,Deny
&#160;&#160;&#160; AllowUser x1
&#160;&#160;&#160; AllowUser x2
&#160;&#160;&#160; AllowUser x3
&#160;&#160;&#160; AllowUser x4
&#160;&#160;&#160; Deny ALL
&#160;&#160;&#160; &lt;/Limit&gt;
&lt;/Directory&gt;
</pre>
<p>Commands to start/stop/restart the service is similar to any service</p>
<p class="codebox">$ sudo /etc/init.d/proftpd start<br />
$ sudo /etc/init.d/proftpd stop<br />
$ sudo /etc/init.d/proftpd restart</p>
<p>Well, this should be enough for setting up basic FTP server securely. =)</p>