Category: General Linux

Setup FTP Linux

* Install FTP

yum install vsftpd

* Configure

vi /etc/vsftpd/vsftpd.conf 

anonymous_enable=NO


pasv_enable=YES
pasv_max_port=35000
pasv_min_port=30000

pasv_address=XXX.XXX.XXX.XXX (local IP)


vi /etc/selinux/config

SELINUX=disabled

Then run from command line:
 setenforce 0
chkconfig vsftpd on

* Create User to access Apache home

useradd -g apache -d /var/www/html $user
passwd $user

* If the user should not have access via SSH please use the following command to add the user instead

useradd -g apache -s /sbin/nologin -d /var/www/html $user 

* Start Service

service vsftpd start

* Set permissions

vi /etc/group

apache:x:##:$user

* Set permissions in web root /var/www/html

chown -R $user:apache *
chmod -R 775 *

Now we need to restrict new ftp user to its home directory by changing the configuration file:

vi /etc/vsftpd/vsftpd.conf
uncomment
chroot_local_user=YES  

How useful was this post?

Click on a star to rate it!

Average rating / 5. Vote count: