{"id":277928,"date":"2021-06-17T14:03:00","date_gmt":"2021-06-17T11:03:00","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/how-to-set-up-a-linux-ftp-server-for-quick-file-transfers-cloudsavvy-it\/"},"modified":"2021-06-17T14:03:00","modified_gmt":"2021-06-17T11:03:00","slug":"how-to-set-up-a-linux-ftp-server-for-quick-file-transfers-cloudsavvy-it","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/how-to-set-up-a-linux-ftp-server-for-quick-file-transfers-cloudsavvy-it\/","title":{"rendered":"#How to Set Up a Linux FTP Server for Quick File Transfers \u2013 CloudSavvy IT"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a2f5bc1551ed\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a2f5bc1551ed\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-set-up-a-linux-ftp-server-for-quick-file-transfers-cloudsavvy-it\/#What_Is_FTP\" >What Is FTP?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-set-up-a-linux-ftp-server-for-quick-file-transfers-cloudsavvy-it\/#Installing_vsftpd\" >Installing vsftpd<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-set-up-a-linux-ftp-server-for-quick-file-transfers-cloudsavvy-it\/#Setting_Up_FTPS\" >Setting Up FTPS<\/a><\/li><\/ul><\/nav><\/div>\n<p><strong>&#8220;#How to Set Up a Linux FTP Server for Quick File Transfers \u2013 CloudSavvy IT&#8221;<\/strong><\/p>\n<div id=\"article-content-area\">\n<img loading=\"lazy\" decoding=\"async\" class=\"type:primaryImage alignnone size-full wp-image-4400\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2020\/04\/dff46e83.png?width=1198&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"filezilla logo\" width=\"700\" height=\"300\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>FTP, or File Transfer Protocol, is a standard protocol for sending and receiving files from remote servers. It\u2019s easier to use than command line alternatives like <code>scp<\/code>, especially with GUI interfaces like FileZilla.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"What_Is_FTP\"><\/span>What Is FTP?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>In the olden days of the internet, public FTP servers were a very common way of making files available to a large number of people. Today, FTP is still around, and widely used for administrative tasks.<\/p>\n<p>While some form of FTP CLI is shipped with most major operating systems, GUI clients like <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/filezilla-project.org\/\">FileZilla<\/a> make the process of moving files between servers as simple as dragging and dropping from local storage onto remote storage, or vice versa. All the underlying traffic is handled using FTP.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-4399 imgchk9\" src=\"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2020\/04\/c0f8baaa.png?trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"\" width=\"700\" height=\"323\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Setting this up requires you to install and configure an FTP server, like <code>vsftpd<\/code>, on the remote machine you want to access.<\/p>\n<p>It should be noted that users logged in via FTP will have access to your system, just like you do. There are steps you can take to mitigate these risks, such as whitelisting access and locking users to their home directories.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Installing_vsftpd\"><\/span>Installing vsftpd<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>To get started, install <code>vsftpd<\/code>\u00a0from your distro\u2019s package manager. For Debian-based systems like Ubuntu, that would be from <code>apt<\/code>:<\/p>\n<pre>sudo apt-get install vsftpd<\/pre>\n<p>Next, you\u2019ll have to start the service and set it to run at boot time:<\/p>\n<pre>systemctl start vsftpd<\/pre>\n<pre class=\"lang:default decode:true hljs shell\"><span class=\"bash\">systemctl <span class=\"hljs-built_in\">enable<\/span> vsftpd&#13;\n<\/span><\/pre>\n<p>FTP has two primary methods of authentication:<\/p>\n<ul>\n<li>Anonymous FTP, where anyone can log in with no password. This is used for public file sharing, and is disabled by default.<\/li>\n<li>Local User Login, which allows any user in <code>\/etc\/passwd<\/code>\u00a0to access FTP using a username and password.<\/li>\n<\/ul>\n<p>You\u2019ll probably want to enable local user login, and keep anonymous access disabled. Signing into FTP using your user account will give you access to anything your account can access.<\/p>\n<p>Open up <code>\/etc\/vsftpd.conf<\/code>\u00a0in your favorite text editor, and change the following line to <code>YES<\/code>:<\/p>\n<pre>local_enable=YES<\/pre>\n<p>If you want to be able to upload files, change <code>write_enable<\/code>\u00a0to <code>YES<\/code>\u00a0as well:<\/p>\n<pre>write_enable=YES<\/pre>\n<p>With a restart of <code>vsftpd<\/code>\u00a0(<code>systemctl restart vsftpd<\/code>), you should now be able to login to FTP using a client like FileZilla, or the CLI on your personal machine.<\/p>\n<p>If you only want to enable FTP for specific users, you can whitelist access. Open up <code>\/etc\/vsftpd.userlist<\/code>, and add the names of each account you want to enable on seperate lines.<\/p>\n<pre>nano \/etc\/vsftpd.userlist<\/pre>\n<p>Then, add the following lines to <code>\/etc\/vsftpd.conf<\/code>:<\/p>\n<pre>userlist_enable=YES&#13;\nuserlist_file=\/etc\/vsftpd.userlist&#13;\nuserlist_deny=NO<\/pre>\n<p>This will restrict access to only the users defined in the userlist file, and deny all others.<\/p>\n<p>If you don\u2019t want users accessing files outside of their home directory, you can place them in a chroot jail, which will prevent them from interacting with any upper-level directories. You can enable this by uncommenting the following line in <code>\/etc\/vsftpd.conf<\/code>:<\/p>\n<pre>chroot_local_user=YES<\/pre>\n<p>Restart <code>vsftpd<\/code>\u00a0with <code>systemctl restart vsftpd<\/code> \u00a0to <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">app<\/a>ly the changes.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Setting_Up_FTPS\"><\/span>Setting Up FTPS<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Standard FTP traffic is sent unencrypted like HTTP. This obviously isn\u2019t great, so you should configure <code>vsftpd<\/code>\u00a0to encrypt traffic with TLS.<\/p>\n<p>To do so, generate a new key and sign a request with <code>openssl<\/code>:<\/p>\n<pre>openssl genrsa -des3 -out FTP.key&#13;\n&#13;\nopenssl req -<span class=\"hljs-keyword\">new<\/span> -key FTP.key -out certificate.csr<\/pre>\n<p><code>vsftpd<\/code>\u00a0needs the password removed from this key, so copy the key and pass it back to <code>openssl<\/code>:<\/p>\n<pre>cp FTP.key FTP.key.orig&#13;\n&#13;\nopenssl rsa -in FTP.key.orig -out ftp.key<\/pre>\n<p>Finally, generate a TLS certificate using this key:<\/p>\n<pre class=\"hljs shell\"><span class=\"bash\">openssl x509 -req -days 365 -<span class=\"hljs-keyword\">in<\/span> certificate.csr -signkey ftp.key -out mycertificate.crt<\/span><\/pre>\n<p>Copy the key and cert over to <code>\/etc\/pki\/tls\/certs\/<\/code>:<\/p>\n<pre>cp ftp.key \/etc\/pki\/tls\/certs\/&#13;\n&#13;\ncp mycertificate.crt \/etc\/pki\/tls\/certs<\/pre>\n<p>Now that all the certs are set up, you can once again open up <code>\/etc\/vsftpd.conf<\/code>, and add the following lines:<\/p>\n<pre>ssl_enable=YES&#13;\nallow_anon_ssl=YES&#13;\nssl_tlsv1=YES&#13;\nssl_sslv2=NO&#13;\nssl_sslv3=NO&#13;\nrsa_cert_file=\/etc\/pki\/tls\/certs\/mycertificate.crt&#13;\nrsa_private_key_file=\/etc\/pki\/tls\/certs\/ftp.key&#13;\nssl_ciphers=HIGH&#13;\nrequire_ssl_reuse=NO<\/pre>\n<p>Restart <code>vsftpd<\/code>\u00a0with <code>systemctl restart vsftpd<\/code>\u00a0to apply the changes.\n<\/div>\n<blockquote><p><strong><span style=\"color: #ff6600;\">If you liked the article, do not forget to share it with your friends. Follow us on\u00a0<span style=\"color: #ff0000;\"><a style=\"color: #ff0000;\" href=\"https:\/\/news.google.com\/publications\/CAAqBwgKMLG0nwswvr63Aw\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Google News<\/a><\/span>\u00a0too, click on the star and choose us from your favorites.<\/span><\/strong><\/p><\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/www.cloudsavvyit.com\/4377\/how-to-set-up-a-linux-ftp-server-for-quick-file-transfers\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;#How to Set Up a Linux FTP Server for Quick File Transfers \u2013 CloudSavvy IT&#8221; FTP, or File Transfer Protocol, is a standard protocol for sending and receiving files from remote servers. It\u2019s easier to use than command line alternatives like scp, especially with GUI interfaces like FileZilla. What Is FTP? In the olden days&#8230;<\/p>\n","protected":false},"author":1,"featured_media":277929,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2020\/04\/dff46e83.png","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-277928","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/277928","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=277928"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/277928\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/277929"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=277928"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=277928"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=277928"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}