{"id":5726,"date":"2018-07-24T17:09:41","date_gmt":"2018-07-24T13:09:41","guid":{"rendered":"https:\/\/www.howtoforge.com\/tutorial\/ubuntu-vsftpd\/"},"modified":"2018-07-24T17:09:41","modified_gmt":"2018-07-24T13:09:41","slug":"install-and-configure-vsftpd-server-on-ubuntu-18-04-lts","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/install-and-configure-vsftpd-server-on-ubuntu-18-04-lts\/","title":{"rendered":"Install and Configure VSFTPD server on Ubuntu 18.04 LTS"},"content":{"rendered":"<p>Vsftpd also known as a very secure FTP daemon is an FTP server for Unix-like systems. FTP is most widely used standard network protocol used for uploading\/downloading files between two computers over a network. By default, FTP is insecure because it transmits data together with user credentials without encryption.<\/p>\n<p>In this tutorial, we will learn how to install Vsftpd with SSL\/TLS support on Ubuntu 18.04 server.<\/p>\n<h2 id=\"requirements\">Requirements<\/h2>\n<ul>\n<li>A server running Ubuntu 18.04.<\/li>\n<li>A non-root user with sudo privileges.<\/li>\n<li>Static IP address 192.168.0.102 is configured.<\/li>\n<\/ul>\n<h2 id=\"install-vsftpd\">Install Vsftpd<\/h2>\n<p>By default, Vsftpd is available in Ubuntu 18.04 default repository. So you can easily install it by just running the following command:<\/p>\n<p class=\"command\">sudo apt-get install vsftpd -y<\/p>\n<p>Once Vsftpd is installed, start Vsftpd service and enable it to start on boot time:<\/p>\n<p class=\"command\">sudo systemctl start vsftpd<br \/>sudo systemctl enable vsftpd<\/p>\n<h2 id=\"create-directory-structure-for-ftp\">Create Directory Structure for FTP<\/h2>\n<p>Before starting, you will need to create a user for FTP access.<\/p>\n<p>You can create a user with the following command:<\/p>\n<p class=\"command\">sudo adduser vsftp<\/p>\n<p>Next, create ftp directory and set ownership with the following command:<\/p>\n<p class=\"command\">sudo mkdir \/home\/vsftp\/ftp<br \/>sudo chown nobody:nogroup \/home\/vsftp\/ftp<br \/>sudo chmod a-w \/home\/vsftp\/ftp<\/p>\n<p>Next, create a directory where files can be uploaded and give ownership to vsftp user:<\/p>\n<p class=\"command\">sudo mkdir \/home\/vsftp\/ftp\/test<br \/>sudo chown vsftp:vsftp \/home\/vsftp\/ftp\/test<\/p>\n<h2 id=\"configure-vsftpd\">Configure Vsftpd<\/h2>\n<p>Next, you will need to perform some configurations to setup FTP server.<\/p>\n<p>First, create a backup of original config file:<\/p>\n<p class=\"command\">sudo cp \/etc\/vsftpd.conf \/etc\/vsftpd.conf.bak<\/p>\n<p>Next, open the vsftpd.conf file:<\/p>\n<p class=\"command\">sudo nano \/etc\/vsftpd.conf<\/p>\n<p>Add the following lines:<\/p>\n<pre> listen=NO&#13; listen_ipv6=YES&#13; anonymous_enable=NO&#13; local_enable=YES&#13; write_enable=YES&#13; local_umask=022&#13; dirmessage_enable=YES&#13; use_localtime=YES&#13; xferlog_enable=YES&#13; connect_from_port_20=YES&#13; chroot_local_user=YES&#13; secure_chroot_dir=\/var\/run\/vsftpd\/empty&#13; pam_service_name=vsftpd&#13; pasv_enable=Yes&#13; pasv_min_port=10000&#13; pasv_max_port=11000&#13; user_sub_token=$USER&#13; local_root=\/home\/$USER\/ftp&#13; userlist_enable=YES&#13; userlist_file=\/etc\/vsftpd.userlist&#13; userlist_deny=NO&#13;\n<\/pre>\n<p>Save and close the file. You can change the above configuration according to your needs.<\/p>\n<p>Next, you will also need to add vsftp user to \/etc\/vsftpd.userlist file to allow FTP access:<\/p>\n<p class=\"command\">sudo nano \/etc\/vsftpd.userlist<\/p>\n<p>Add the following line:<\/p>\n<pre>vsftp&#13;\n<\/pre>\n<p>Save and close the file, then restart Vsftpd service to apply these changes:<\/p>\n<p class=\"command\">sudo systemctl restart vsftpd<\/p>\n<p>Now, open your web browser and type the URL <strong>ftp:\/\/92.168.0.102<\/strong>, you will be asked to enter username and password to access FTP.\u00a0 Enter your vsftp username and password, then click on the <strong>Ok<\/strong> button. You should see the following page:<\/p>\n<p><a class=\"fancybox\" id=\"img-page1\" href=\"https:\/\/www.howtoforge.com\/images\/install_and_configure_vsftpd_server_on_ubuntu_1804\/big\/page1.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/install-and-configure-vsftpd-server-on-ubuntu-18-04-lts.png\" alt=\"Access server by FTP\" width=\"550\" height=\"264\" title=\"\"><\/a><\/p>\n<h2 id=\"secure-vsftpd-using-ssltls\">Secure Vsftpd using SSL\/TLS<\/h2>\n<p>Next, you will need to enable SSL\/TLS to encrypt the data transferred via FTP.<\/p>\n<p>To do so, you will need to create a certificate for that. You can create a certificate using OpenSSL using the following command:<\/p>\n<p class=\"command\">sudo mkdir \/etc\/cert<br \/>sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout \/etc\/cert\/vsftpd.pem -out \/etc\/cert\/vsftpd.pem<\/p>\n<p>Next, you will need to modify vsftpd.conf file and make some changes:<\/p>\n<p class=\"command\">sudo nano \/etc\/vsftpd.conf<\/p>\n<p>Add the following lines:<\/p>\n<pre>rsa_cert_file=\/etc\/cert\/vsftpd.pem&#13;\nrsa_private_key_file=\/etc\/cert\/vsftpd.pem&#13;\nssl_enable=YES&#13;\nallow_anon_ssl=NO&#13;\nforce_local_data_ssl=YES&#13;\nforce_local_logins_ssl=YES&#13;\nssl_tlsv1=YES&#13;\nssl_sslv2=NO&#13;\nssl_sslv3=NO&#13;\nrequire_ssl_reuse=NO&#13;\nssl_ciphers=HIGH&#13;\n<\/pre>\n<p>Save the file, then restart Vsftpd using the following command:<\/p>\n<p class=\"command\">sudo systemctl restart vsftpd<\/p>\n<h2 id=\"access-ftp-over-ssltls\">Access FTP over SSL\/TLS<\/h2>\n<p>You can not access your FTP server over SSL\/TLS through browser. So, you will need to install FileZilla FTP client to access your FTP server. Because FileZilla supports FTP over SSL\/TLS.<\/p>\n<p>You can install FileZilla client using the following command:<\/p>\n<p class=\"command\">sudo apt-get install filezilla -y<\/p>\n<p>Once the FileZilla is installed, open it from your Unity dash. You should see the following image:<\/p>\n<p><a class=\"fancybox\" id=\"img-page2\" href=\"https:\/\/www.howtoforge.com\/images\/install_and_configure_vsftpd_server_on_ubuntu_1804\/big\/page2.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/install-and-configure-vsftpd-server-on-ubuntu-18-04-lts-1.png\" alt=\"FileZilla FTP Client\" width=\"550\" height=\"441\" title=\"\"><\/a><\/p>\n<p>Now, click on the <strong>File&gt;Sites Manager<\/strong>. You should see the following image:<\/p>\n<p><a class=\"fancybox\" id=\"img-image3\" href=\"https:\/\/www.howtoforge.com\/images\/install_and_configure_vsftpd_server_on_ubuntu_1804\/big\/image3.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/install-and-configure-vsftpd-server-on-ubuntu-18-04-lts-2.png\" alt=\"Add site in FileZilla\" width=\"550\" height=\"444\" title=\"\"><\/a><\/p>\n<p>Here, add New site and provide the host\/site name, add the IP address, define the protocol to use, encryption and logon type. Then click on the <strong>Connect<\/strong> button. You should see the following image:<\/p>\n<p><a class=\"fancybox\" id=\"img-image5\" href=\"https:\/\/www.howtoforge.com\/images\/install_and_configure_vsftpd_server_on_ubuntu_1804\/big\/image5.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/install-and-configure-vsftpd-server-on-ubuntu-18-04-lts-3.png\" alt=\"Accept SSL certificate\" width=\"550\" height=\"547\" title=\"\"><\/a><\/p>\n<p>Now, verify the certificate being used for the SSL\/TLS connection, and click <strong>OK<\/strong> once more to connect to the FTP server. You should see your FTP server contents in the following page:<\/p>\n<p><a class=\"fancybox\" id=\"img-image6\" href=\"https:\/\/www.howtoforge.com\/images\/install_and_configure_vsftpd_server_on_ubuntu_1804\/big\/image6.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/install-and-configure-vsftpd-server-on-ubuntu-18-04-lts-4.png\" alt=\"FTP connection to Vsftpd server established\" width=\"550\" height=\"448\" title=\"\"><\/a><\/p>\n<div>\n<p><b>Share this page:<\/b><\/p>\n<p>\n<a href=\"https:\/\/www.facebook.com\/sharer.php?u=https%3A%2F%2Fwww.howtoforge.com%2Ftutorial%2Fubuntu-vsftpd%2F\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/install-and-configure-vsftpd-server-on-ubuntu-18-04-lts-5.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Fwww.howtoforge.com%2Ftutorial%2Fubuntu-vsftpd%2F&amp;text=Install+and+Configure+VSFTPD+server+on+Ubuntu+18.04+LTS&amp;via=howtoforgecom&amp;related=howtoforgecom\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/install-and-configure-vsftpd-server-on-ubuntu-18-04-lts-6.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/twitter.com\/howtoforgecom\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/install-and-configure-vsftpd-server-on-ubuntu-18-04-lts-7.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/plus.google.com\/share?url=https%3A%2F%2Fwww.howtoforge.com%2Ftutorial%2Fubuntu-vsftpd%2F\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/install-and-configure-vsftpd-server-on-ubuntu-18-04-lts-8.png\" height=\"20\" alt=\"\" title=\"\"><\/a>\n<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Vsftpd also known as a very secure FTP daemon is an FTP server for Unix-like systems. FTP is most widely used standard network protocol used for uploading\/downloading files between two computers over a network. By default, FTP is insecure because it transmits data together with user credentials without encryption. In this tutorial, we will learn [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-5726","post","type-post","status-publish","format-standard","hentry","category-36"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/5726","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=5726"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/5726\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=5726"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=5726"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=5726"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}