{"id":605,"date":"2011-08-10T14:30:46","date_gmt":"2011-08-10T04:30:46","guid":{"rendered":"http:\/\/howden.net.au\/thowden\/?p=605"},"modified":"2011-08-10T14:30:46","modified_gmt":"2011-08-10T04:30:46","slug":"debian-6-0-2-squeeze-proftp-chroot-and-all-that-jazz","status":"publish","type":"post","link":"https:\/\/howden.net.au\/thowden\/2011\/08\/debian-6-0-2-squeeze-proftp-chroot-and-all-that-jazz\/","title":{"rendered":"Debian 6.0.2 Squeeze, ProFTP, chroot and all that jazz"},"content":{"rendered":"<p>A base install of Debian squeeze does not include some of the tools required to establish a secure FTP server.<\/p>\n<p>I started at<\/p>\n<p><a href=\"http:\/\/www.debian-administration.org\/article\/228\/Setting_up_an_FTP_server_on_Debian\">http:\/\/www.debian-administration.org\/article\/228\/Setting_up_an_FTP_server_on_Debian<\/a><\/p>\n<p>The <a href=\"http:\/\/www.proftpd.org\/docs\/howto\/TLS.html\">ProFTP reference for TLS<\/a> is somewhat sparse for step-by-step requiring some degree of thinking. Which is fine except if I am in a hurry.<\/p>\n<p><a href=\"http:\/\/www.howtoforge.com\/proftpd-tls-debian-etch\">How-to-Forge regarding Debian Etch<\/a> gave some information that was relevant but missing a couple of steps that apply in the later Squeeze version of Debian (6.0.2).<\/p>\n<p>So my steps for future reference are as follows:<\/p>\n<p>Start by installing and establishing a basic FTP server. Not secured but functioning is the goal.<\/p>\n<p>[bash]<br \/>\n#apt-get install proftpd-basic proftpd-doc<br \/>\n[\/bash]<\/p>\n<p>During the ProFTP install it will prompt for inetd or stand-alone, select stand-alone.<\/p>\n<p>Create a test user account and password with adduser on the Debian system.<\/p>\n<p>Test with a <a title=\"Filezilla FTP Client\" href=\"http:\/\/filezilla-project.org\/\">FileZilla<\/a> install for a basic FTP connection on port 21. If this is working a basic connection will allow the user to see the entire server.<\/p>\n<p>Based on the config \/etc\/proftpd\/proftpd.conf setting to chroot the user to their \/home\/ directory will restrict the user login to only their home directory. Enable the line by removing the # sign at the start of the line in \/etc\/proftpd\/proftpd.conf<\/p>\n<p>[text]<br \/>\nDefaultRoot<br \/>\n[\/text]<\/p>\n<p>Stop and restart the proftpd service<\/p>\n<p>[bash]<br \/>\n#service proftpd restart<br \/>\n[\/bash]<\/p>\n<p>Test again with a <a title=\"Filezilla FTP Client\" href=\"http:\/\/filezilla-project.org\/\">FileZilla<\/a> install for a chroot FTP connection on port 21. It will probably fail unless the next step was done previously.<\/p>\n<p>Check tail \/var\/log\/proftpd\/proftpd.log for errors like this:<\/p>\n<p>[text]<br \/>\nAug 09 16:30:44 server_name proftpd[9625] fq_server_name (::ffff:ip_address[::ffff:ip_address]): Preparing to chroot to directory &#8216;\/home\/username\/&#8217;<br \/>\nAug 09 16:30:44 server_name proftpd[9625] fq_server_name (::ffff:ip_address[::ffff:ip_address]): chroot to &#8216;\/home\/username\/&#8217; failed for user &#8216;username&#8217;: Operation not permitted<br \/>\nAug 09 16:30:44 server_name proftpd[9625] fq_server_name (::ffff:ip_address[::ffff:ip_address]): error: unable to set default root directory<br \/>\n[\/text]<\/p>\n<p>The issue is that chroot is not installed by default and therefore a Filezilla connection should fail.<\/p>\n<p>[bash]<br \/>\napt-get install chrootuid<br \/>\n[\/bash]<\/p>\n<p>Stop and restart the proftpd service<\/p>\n<p>[bash]<br \/>\n#service proftpd restart<br \/>\n[\/bash]<\/p>\n<p>Test again with a <a title=\"Filezilla FTP Client\" href=\"http:\/\/filezilla-project.org\/\">FileZilla<\/a> install for a basic FTP connection on port 21 to the users home directory.<\/p>\n<p>Once that is working adding TLS takes a few more steps.<\/p>\n<p>Find and enable the following line by removing the # sign at the start of the line in<\/p>\n<p>\/etc\/proftpd\/proftpd.conf<\/p>\n<p>[text]<br \/>\ninclude \/etc\/proftpd\/tls.conf<br \/>\n[\/text]<\/p>\n<p>Install openssl<\/p>\n<p>[bash]<br \/>\n# apt-get install openssl<br \/>\n[\/bash]<\/p>\n<p>Follow the details on <a href=\"http:\/\/www.howtoforge.com\/proftpd-tls-debian-etch\">How-to-Forge for creating a self-signed certificate<\/a> for the FTP server in Step 3 Creating The SSL Certificate For TLS.<\/p>\n<p>Step 4 Enabling TLS In ProFTPd is no longer correct for this version of Debian. The tls section is no longer in the \/etc\/proftpd\/proftpd.conf but as a separate file in the same directory<\/p>\n<p>Edit \/etc\/proftpd\/tls.conf instead of \/etc\/proftpd\/proftpd.conf<\/p>\n<p>Turn on the appropriate sections and edit the relevant paths to suit your certificate locations.<\/p>\n<p>Stop and restart the proftpd service<\/p>\n<p>[bash]<\/p>\n<p>#service proftpd restart<\/p>\n<p>[\/bash]<\/p>\n<p>Modify the Filezilla settings to use Require explicit FTP over TLS and test again. The prompt for the certificate acceptance is because it is self-signed and tick the box to retain the certificate so that the prompt disappears.<\/p>\n<p>Note that the self-signed certificate is valid only for 365 days and in a year it will need to be renewed.<\/p>\n<p>I also referenced <a href=\"http:\/\/www.delphi3000.com\/articles\/article_4881.asp\">http:\/\/www.delphi3000.com\/articles\/article_4881.asp<\/a> regarding the differences between SFTP and FTPS.<\/p>\n<p>And this section of the <a href=\"http:\/\/www.proftpd.org\/docs\/howto\/Chroot.html\">ProFTP documentation<\/a> for chroot information.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A base install of Debian squeeze does not include some of the tools required to establish a secure FTP server. I started at http:\/\/www.debian-administration.org\/article\/228\/Setting_up_an_FTP_server_on_Debian The ProFTP reference for TLS is somewhat sparse for step-by-step requiring some degree of thinking. Which is fine except if I am in a hurry. How-to-Forge regarding Debian Etch gave some [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,14],"tags":[],"class_list":["post-605","post","type-post","status-publish","format-standard","hentry","category-linux-servers-and-software","category-security"],"_links":{"self":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/posts\/605","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/comments?post=605"}],"version-history":[{"count":0,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/posts\/605\/revisions"}],"wp:attachment":[{"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/media?parent=605"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/categories?post=605"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/howden.net.au\/thowden\/wp-json\/wp\/v2\/tags?post=605"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}