{"id":1449,"date":"2020-12-31T23:11:28","date_gmt":"2020-12-31T21:11:28","guid":{"rendered":"http:\/\/www.shukko.com\/x3\/?p=1449"},"modified":"2020-12-31T23:11:28","modified_gmt":"2020-12-31T21:11:28","slug":"how-to-install-pure-ftpd-with-lets-encrypt","status":"publish","type":"post","link":"https:\/\/www.shukko.com\/x3\/2020\/12\/31\/how-to-install-pure-ftpd-with-lets-encrypt\/","title":{"rendered":"How to Install Pure-FTPd with Let\u2019s Encrypt"},"content":{"rendered":"\n<p>taken from: https:\/\/hostio.solutions\/kb\/how-to-install\/pure-ftpd\/<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">How to Install Pure-FTPd with Let\u2019s Encrypt<\/h1>\n\n\n\n<p>If you manage multiple servers, it is super important to make backups yourself. Hosting providers often do offer backup services, however, it\u2019s also important to have a back-up server elsewhere so that you always have access to your own data. This is especially useful when, for example, your hosting provider is completely offline.<\/p>\n\n\n\n<p>In this \u201chow to install\u201d we\u2019ll explain step by step how you can setup an FTP server with Pure-FTPd and how you can secure it with a certificate.<\/p>\n\n\n\n<p>For this setup, we recommend that you use a dedicated server with Debian 10.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 1: Update server<\/h2>\n\n\n\n<p>Make sure that your Debian 10 server is up-to-date.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 2: Pure-FTPd installation<\/h2>\n\n\n\n<p>When your server is up-to-date, we can install the FTP server with Pure FTPd. For this, we use the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get install pure-ftpd<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 3: Configuration and setup of Pure-FTPd<\/h2>\n\n\n\n<p>To ensure that everything runs properly, the following commands must be executed:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">echo \"yes\" &gt; \/etc\/pure-ftpd\/conf\/Daemonize<br>echo \"yes\" &gt; \/etc\/pure-ftpd\/conf\/NoAnonymous<br>echo \"yes\" &gt; \/etc\/pure-ftpd\/conf\/ChrootEveryone<br>echo \"2\" &gt; \/etc\/pure-ftpd\/conf\/TLS<\/pre>\n\n\n\n<p>We recommend setting your FTP to IPv4 only, as the performance of IPv6 is not the same for every provider. You can do this by using the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \"yes\" > \/etc\/pure-ftpd\/conf\/IPV4Only<\/code><\/pre>\n\n\n\n<p>Now we are going to set the config. Out of experience we know that the following works best:<\/p>\n\n\n\n<p>We start with deleting the existing config. To do this, you can use the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">rm -rf \/etc\/pure-ftpd\/pure-ftpd.conf<\/pre>\n\n\n\n<p>Now that we\u2019ve deleted the existing config, we can complete the config file with our settings. Open the pure-ftpd.conf.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nano \/etc\/pure-ftpd\/pure-ftpd.conf<\/pre>\n\n\n\n<p>Now that we have the text editor open, you can copy &amp; paste the following:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ChrootEveryone               \t\tyes<br>BrokenClientsCompatibility   \tno<br>MaxClientsNumber             \t        50<br>Daemonize                   \t\t        yes<br>MaxClientsPerIP              \t\t8<br>VerboseLog                   \t\tno<br>DisplayDotFiles              \t\tyes<br>AnonymousOnly                \t\tno<br>NoAnonymous                  \t\tno<br>SyslogFacility               \t\t        ftp<br>DontResolve                  \t\tyes<br>MaxIdleTime                  \t\t15<br>LimitRecursion               \t\t10000<br>AnonymousCanCreateDirs     \tno<br>MaxLoad                      \t\t        4<br>AntiWarez                    \t\t        yes<br>Umask                        \t\t\t133:022<br>MinUID                       \t\t\t100<br>AllowUserFXP                 \t\tno<br>AllowAnonymousFXP            \tno<br>ProhibitDotFilesWrite        \t        no<br>ProhibitDotFilesRead         \t        no<br>AutoRename                   \t\tno<br>AnonymousCantUpload         \tno<br>MaxDiskUsage                   \t\t99<br>CustomerProof                \t\tyes<br>CertFile                       \t\t        \/etc\/ssl\/private\/pure-ftpd.pem<\/pre>\n\n\n\n<p>Everything is now set up and configured.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Step 4: Secure the FTP server with Let\u2019s Encrypt.<\/h2>\n\n\n\n<p>It\u2019s important to make sure that you\u2019re using a secure connection for your FTP traffic.<\/p>\n\n\n\n<p>If you want to use an SSL\/TLS, we first need to create the folder for it. The certificate will be placed in this folder. To do this, you can use the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mkdir -p \/etc\/ssl\/pure-ftpd<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Secure your FTP server with the SSL of Let\u2019s Encrypt<\/h3>\n\n\n\n<p>In order to use Let\u2019s Encrypt we first have to install&nbsp;<a href=\"https:\/\/certbot.eff.org\/\">Certbot.<\/a><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">apt-get install certbot<\/pre>\n\n\n\n<p>Now that we have done the installation, it is time to request an SSL. Make sure you have a hostname and A record for your server and go through all the steps of certbot.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">certbot certonly --standalone<\/pre>\n\n\n\n<p>Now we are going to merge the created Let\u2019s Encrypt certificate files. We do this with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cat \/etc\/letsencrypt\/live\/*\/privkey.pem \/etc\/letsencrypt\/live\/*\/fullchain.pem &gt; \/etc\/ssl\/private\/pure-ftpd.pem<\/pre>\n\n\n\n<p>After we\u2019ve merged the certificates, we have to make sure that the renewed SSL is automatically merged via cronob:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nano \/etc\/cron.d\/certbot<\/pre>\n\n\n\n<p>If all goes well, the last line should say:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">0 *\/12 * * * root test -x \/usr\/bin\/certbot -a \\! -d \/run\/systemd\/system &amp;&amp; perl -e 'sleep int(rand(43200))' &amp;&amp; certbot -q renew<\/pre>\n\n\n\n<p>Now we have to add the following to the last line:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">&amp;&amp; cat \/etc\/letsencrypt\/live\/*\/privkey.pem \/etc\/letsencrypt\/live\/*\/fullchain.pem &gt; \/etc\/ssl\/private\/pure-ftpd.pem<\/pre>\n\n\n\n<p>It should then look as follows:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">0 *\/12 * * * root test -x \/usr\/bin\/certbot -a \\! -d \/run\/systemd\/system &amp;&amp; perl -e 'sleep int(rand(43200))' &amp;&amp; certbot -q renew &amp;&amp; cat \/etc\/letsencrypt\/live\/*\/privkey.pem \/etc\/letsencrypt\/live\/*\/fullchain.pem &gt; \/etc\/ssl\/private\/pure-ftpd.pem<\/pre>\n\n\n\n<p>If all went well, we can restart Pure-FTPd with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">service pure-ftpd restart<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Step 5: create user(s)<\/h2>\n\n\n\n<p>There are two ways: create a user with SSH access or create a user without SSH access and set a storage limit.<\/p>\n\n\n\n<p>For every account that is created, a home profile is created at \/home.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Easy way to create user(s)<\/h3>\n\n\n\n<p>Use the following command to easily create an user:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">adduser USERNAME<\/pre>\n\n\n\n<p>After entering this command, you can set your password. After having set the password, everything will be ready for this user and a profile will be created on \/home\/username.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Create user with extra options<\/h3>\n\n\n\n<p>If you want to create a user with extra options, we first have to create a user group for FTP users without SSH access.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">groupadd ftpgroup<\/pre>\n\n\n\n<p>Now we can create the user:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">useradd -g ftpgroup -d \/dev\/null -s \/etc USERNAME \n\npure-pw useradd USERNAME -u USERNAME -g ftpgroup -d \/home\/USERNAME<\/pre>\n\n\n\n<p>If you want to give the user a storage limit you can add: -N 1000.<br>This gives the user a storage limit of 1000MB.<\/p>\n\n\n\n<p>Example of the command with a storage limit of 1000 MB:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">pure-pw useradd USERNAME -u ftpuser -g ftpgroup -d \/home\/USERNAME -N 1000<\/pre>\n\n\n\n<p>Now we have to create the directory for the FTP user with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">mkdir \/home\/USERNAME\n\nchown -R USERNAME:ftpgroup \/home\/USERNAME<\/pre>\n\n\n\n<p>The next step is to update the Pure-FTPd database. You can do this with the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">pure-pw mkdb\n\nln -s \/etc\/pure-ftpd\/pureftpd.passwd \/etc\/pureftpd.passwd\n\nln -s \/etc\/pure-ftpd\/pureftpd.pdb \/etc\/pureftpd.pdb\n\nln -s \/etc\/pure-ftpd\/conf\/PureDB \/etc\/pure-ftpd\/auth\/PureDB<\/pre>\n\n\n\n<p>Finally, we have to restart the Pure-FTPd:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">service pure-ftpd restart<\/pre>\n\n\n\n<p>Every time you make changes to a user, the database must be updated:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">pure-pw mkdb<\/pre>\n\n\n\n<p>Do you want to change the password for an FTP user? Then you can use the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">pure-pw passwd USERNAME<\/pre>\n\n\n\n<p>I<\/p>\n","protected":false},"excerpt":{"rendered":"<p>taken from: https:\/\/hostio.solutions\/kb\/how-to-install\/pure-ftpd\/ How to Install Pure-FTPd with Let\u2019s Encrypt If you manage multiple servers, it is super important to make backups yourself. Hosting providers often do offer backup services, however, it\u2019s also important to have a back-up server elsewhere so that you always have access to your own data. This is especially useful when, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1449","post","type-post","status-publish","format-standard","hentry","category-kategerisiz"],"_links":{"self":[{"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/posts\/1449","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/comments?post=1449"}],"version-history":[{"count":1,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/posts\/1449\/revisions"}],"predecessor-version":[{"id":1450,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/posts\/1449\/revisions\/1450"}],"wp:attachment":[{"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/media?parent=1449"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/categories?post=1449"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shukko.com\/x3\/wp-json\/wp\/v2\/tags?post=1449"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}