{"id":4550,"date":"2015-04-13T14:33:49","date_gmt":"2015-04-13T06:33:49","guid":{"rendered":"http:\/\/rmohan.com\/?p=4550"},"modified":"2015-04-13T14:33:49","modified_gmt":"2015-04-13T06:33:49","slug":"setup-ftp-server-on-centos-7","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=4550","title":{"rendered":"Setup FTP server on centos 7"},"content":{"rendered":"<p>yum -y install vsftpd<\/p>\n<p>After installation you can find \/etc\/vsftpd\/vsftpd.conf file which is the main configuration file for VSFTP.<br \/>\nTake a backup copy before making changes .<\/p>\n<p>cp \/etc\/vsftpd\/vsftpd.conf \/etc\/vsftpd\/vsftpd.conf.org<\/p>\n<p>vi \/etc\/vsftpd\/vsftpd.conf<\/p>\n<p>Find this line anonymous_enable=YES ( Line no : 12 ) and change value to NO to disable anonymous FTP access.<\/p>\n<p>anonymous_enable=NO<\/p>\n<p>Uncomment the below line ( Line no : 100 ) to restrict users to their home directory.<br \/>\nchroot_local_user=YES<\/p>\n<p>and add the below lines at the end of the file to enable passive mode and allow chroot writable.<br \/>\nallow_writeable_chroot=YES<br \/>\npasv_enable=Yes<br \/>\npasv_min_port=40000<br \/>\npasv_max_port=40100<\/p>\n<p>Now restart vsftpd service and make it start automatically after reboot.<\/p>\n<p>systemctl restart vsftpd.service<\/p>\n<p>systemctl enable vsftpd.service<\/p>\n<p>Add FTP service in firewall to allow ftp ports .<\/p>\n<p>firewall-cmd &#8211;permanent &#8211;add-service=ftp<br \/>\nfirewall-cmd &#8211;reload<\/p>\n<p>Setup SEinux to allow ftp access to the users home directories<br \/>\nsetsebool -P ftp_home_dir on<\/p>\n<p>Now create an User for ftp access. Here \/sbin\/nologin shell is used to prevent shell access to the server .<\/p>\n<p>useradd -m mohan -s \/sbin\/nologin<br \/>\npasswd mohan<\/p>\n","protected":false},"excerpt":{"rendered":"<p>yum -y install vsftpd<\/p>\n<p>After installation you can find \/etc\/vsftpd\/vsftpd.conf file which is the main configuration file for VSFTP. Take a backup copy before making changes .<\/p>\n<p>cp \/etc\/vsftpd\/vsftpd.conf \/etc\/vsftpd\/vsftpd.conf.org<\/p>\n<p>vi \/etc\/vsftpd\/vsftpd.conf<\/p>\n<p>Find this line anonymous_enable=YES ( Line no : 12 ) and change value to NO to disable anonymous FTP access.<\/p>\n<p>anonymous_enable=NO<\/p>\n<p>Uncomment the [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4550"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4550"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4550\/revisions"}],"predecessor-version":[{"id":4551,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/4550\/revisions\/4551"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4550"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4550"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4550"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}