{"id":3204,"date":"2018-08-23T06:38:24","date_gmt":"2018-08-23T06:38:24","guid":{"rendered":"http:\/\/truelogic.org\/wordpress\/?p=3204"},"modified":"2018-08-23T06:38:24","modified_gmt":"2018-08-23T06:38:24","slug":"setting-up-ftp-for-an-apache-website-under-ubuntu","status":"publish","type":"post","link":"https:\/\/truelogic.org\/wordpress\/2018\/08\/23\/setting-up-ftp-for-an-apache-website-under-ubuntu\/","title":{"rendered":"Setting up FTP for an Apache website under Ubuntu"},"content":{"rendered":"<p>Once you have set up a website under Apache, you would need FTP access to the website to be able to upload files. The steps below explain how to do this.<\/p>\n<p>&nbsp;<\/p>\n<p>1.Install VSFTPD server :<\/p>\n<pre>sudo apt-get install vsftpd<\/pre>\n<p>&nbsp;<\/p>\n<p>2.Make changes to the vsftpd configuration file by uncommenting or adding <em>write_enable=YES<\/em> and <em>chroot_local_user=YES<\/em>\u00a0 and enabling <em>local_umask=022<\/em><\/p>\n<pre># Enable this to allow users to write files to their web folder\r\nwrite_enable=YES\r\n\r\n# To restrict users to specific web folders and block access to parent folders\r\nchroot_local_user=YES\r\n\r\nlocal_umask=022\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>3.Create a user for FTP and ensure that it is part of the www-data group. We are using <em>ftpvc<\/em> as an example user and assume that the website home folder is <em>\/var\/www\/html<\/em><\/p>\n<pre>useradd -s \/usr\/sbin\/nologin ftpvc\r\n\r\nsudo passwd ftpvc # you will be prompted to enter a password twice\r\n\r\nsudo usermod -d \/var\/www\/html ftpvc\r\n\r\nusermod -a -G www-data ftpvc\r\n<\/pre>\n<p>4.Now make sure that the ftp user has not shell to login to the system directly.<\/p>\n<p>Add the following line in <em>\/etc\/shells<\/em><\/p>\n<pre>\/usr\/sbin\/nologin<\/pre>\n<p>Save the file<\/p>\n<p>5.Restart vsftpd server<\/p>\n<pre>service vsftpd restart\r\n\r\n<\/pre>\n<p>6.Make sure that the website folder is owned by the ftp user and the www-data group.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Once you have set up a website under Apache, you would need FTP access to the website to be able to upload files. The steps <a class=\"mh-excerpt-more\" href=\"https:\/\/truelogic.org\/wordpress\/2018\/08\/23\/setting-up-ftp-for-an-apache-website-under-ubuntu\/\" title=\"Setting up FTP for an Apache website under Ubuntu\">[&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":3208,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,298],"tags":[],"class_list":["post-3204","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apachephp","category-linux"],"_links":{"self":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/3204","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/comments?post=3204"}],"version-history":[{"count":5,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/3204\/revisions"}],"predecessor-version":[{"id":3210,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/posts\/3204\/revisions\/3210"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/media\/3208"}],"wp:attachment":[{"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/media?parent=3204"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/categories?post=3204"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/truelogic.org\/wordpress\/wp-json\/wp\/v2\/tags?post=3204"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}