﻿<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Uğur Ethem Aydın Kişisel Blogu &#187; proftpd</title>
	<atom:link href="http://www.ugurethemaydin.com/tag/proftpd/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ugurethemaydin.com</link>
	<description>Girişimci,yazılımcı,reklamcı,pazarlamacı dan tecrübe paylaşımı...</description>
	<lastBuildDate>Thu, 18 Aug 2011 20:00:53 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Setting up an FTP server on Debian</title>
		<link>http://www.ugurethemaydin.com/linuxdebian/273-setting-up-an-ftp-server-on-debian.html</link>
		<comments>http://www.ugurethemaydin.com/linuxdebian/273-setting-up-an-ftp-server-on-debian.html#comments</comments>
		<pubDate>Fri, 21 May 2010 06:42:33 +0000</pubDate>
		<dc:creator>Uğur Ethem AYDIN</dc:creator>
				<category><![CDATA[Linux/Debian]]></category>
		<category><![CDATA[ftp]]></category>
		<category><![CDATA[network servers]]></category>
		<category><![CDATA[proftpd]]></category>

		<guid isPermaLink="false">http://www.ugurethemaydin.com/?p=273</guid>
		<description><![CDATA[Setting up an FTP server on Debian
As a means of distributing large collections of files FTP is still a popular  choice, despite the rise of bittorrent, and the growing number of HTTP  servers.
FTP is an often overlooked method of storing and giving access to files, in  many cases FTP servers have been [...]]]></description>
			<content:encoded><![CDATA[<h2>Setting up an FTP server on Debian</h2>
<p>As a means of distributing large collections of files FTP is still a popular  choice, despite the rise of bittorrent, and the growing number of HTTP  servers.</p>
<p>FTP is an often overlooked method of storing and giving access to files, in  many cases FTP servers have been retired in place of webservers such as  Apache.</p>
<p>But there are a lot of cases where offering access via FTP makes sense, even  with the limitations of FTP &#8211; most notably the difficulty of firewalling and the  security risk involved in using plaintext passwords.</p>
<p><span id="more-273"></span></p>
<p>There are several different FTP servers packaged within Debian, which you can  see via:</p>
<pre class="brush: vb;">apt-cache search ftp-server</pre>
<p>One of the most popular servers around is <a href="http://www.proftpd.org/">proftpd</a>, and that can be installed upon  Debian systems with:   <code>apt-get install proftpd</code> Once downloaded <tt>debconf</tt> will ask if you wish to run the server via  <tt>inetd</tt>, or in a standalone fashion. In general you want the latter  option.  After the installation the server will be running, and will grant access to  all user accounts upon the host.  If you wish to stop the server prior to more configuration you can do so  with:</p>
<pre>/etc/init.d/proftpd stop</pre>
<p>The configuration of <tt>proftpd</tt> is conducted via the configuration file  of <tt>/etc/proftpd.conf</tt>.</p>
<p><strong>Security Options</strong></p>
<p>There are several security options you can enable in <tt>proftpd</tt>, the  most notable is the use of TLS security.</p>
<p>To use TLS you will need to generate a key, and update your server&#8217;s  configuration file to use it.</p>
<p>Generating a key is simple enough with the <tt>openssl</tt> command, which is  contained in the <a href="http://packages.debian.org/openssl">openssl  package</a>:</p>
<pre>mkdir /etc/proftpd
cd /etc/proftpd
openssl req -new -x509 -days 365 -nodes -out ftpd-rsa.pem \
   -keyout ftpd-rsa-key.pem</pre>
<p>With the files generated you can add the following to your  <tt>proftpd.conf</tt> file:</p>
<pre>&lt;IfModule mod_tls.c&gt;
   TLSEngine on
   TLSLog /var/log/proftpd-tls.log
   TLSProtocol TLSv1

   # Are clients required to use FTP over TLS when talking to this server?
   TLSRequired off

   TLSRSACertificateFile    /etc/proftpd/ftpd-rsa.pem
   TLSRSACertificateKeyFile /etc/proftpd/ftpd-rsa-key.pem

   # Authenticate clients that want to use FTP over TLS?
   TLSVerifyClient off
&lt;/IfModule&gt;</pre>
<p>Other security options include limiting users to particular directories. To  limit the user &#8220;bob&#8221; to the starting directory &#8220;/tmp&#8221; you can use:</p>
<pre>DefaultRoot /tmp bob</pre>
<p>The more general approach is to restrict users to their own home directory,  which you can accomplish via:</p>
<pre>DefaultRoot ~</pre>
<p>This causes all users to be presented with the contents of their home  directory (as specified by <tt>/etc/passwd</tt>) when they  login.</p>
<p><strong>Permitting Anonymous Access</strong></p>
<p>To permit anonymous access to your server you will need to uncomment the  configuration options which are already present in the standard  <tt>/etc/proftpd.conf</tt> file.</p>
<p>This is a good starting point:</p>
<pre>&lt;Anonymous ~ftp&gt;
   User				ftp
   Group			nogroup

   # We want clients to be able to login with "anonymous" as well as "ftp"
   UserAlias			anonymous ftp

   # Cosmetic changes, all files belongs to ftp user
   DirFakeUser	on ftp
   DirFakeGroup on ftp

   RequireValidShell		off

   # Limit the maximum number of anonymous logins
   MaxClients			10

   # We want 'welcome.msg' displayed at login, and '.message' displayed
   # in each newly chdired directory.
   DisplayLogin			welcome.msg
   DisplayFirstChdir		.message

   # Limit WRITE everywhere in the anonymous chroot
   &lt;Directory *&gt;
     &lt;Limit WRITE&gt;
       DenyAll
     &lt;/Limit&gt;
   &lt;/Directory&gt;
&lt;/Anonymous&gt;</pre>
<p>This configuration setting allows users to login with either  <tt>anonymous</tt>, or <tt>ftp</tt>, as username and they will be able to read  from <tt>/home/ftp</tt>.</p>
<p>Thankfully they will be unable to upload new content, or delete existing  files. They will be given only read-only access to the  server.</p>
<p><strong>Miscallaneous Options</strong><br />
There are some other options which you might wish to change, for example the  welcome message presented to clients.</p>
<p>The welcome message presented is read from <tt>/home/ftp/welcome.msg</tt>,  editing that file will immediately change the text sent to users.</p>
<p>The hostname of your server is typically displayed to clients when they  connect &#8211; in the Debian package the greeting only includes the string &#8220;Debian&#8221; &#8211;  as you can see from the following session:</p>
<pre>user@host:~ ftp localhost
Connected to localhost.localdomain.
220 ProFTPD 1.2.10 Server (Debian) [127.0.0.1]</pre>
<p>To change this update the <tt>proftpd.conf</tt> file to include:</p>
<pre>ServerName "My.host.name"</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ugurethemaydin.com/linuxdebian/273-setting-up-an-ftp-server-on-debian.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

