Thursday, March 20, 2014

FTP access locked at web directory

This post will teach you how to install FTP service to your server and create users which is locked to web directories.

Install FTP services
     # yum install vsftpd

now we create user which is without home directory and remove users mailbox. Then we will update its password.
     # useradd -M ftpuser
     # rm -rf /var/spool/mail/ftpuser
     # passwd ftpuser

this will make parent directory and update it to user login directory
     # mkdir -p /var/www/html/ftpfiles
     # usermod -d /var/www/html/ftpfiles

Open and edit ftp config to lock the user at their home directory
     # vim /etc/vsftpd/vsftpd.conf

and enable " chroot_local_user=YES "

Now this ftpuser will be lock at its home directory once login and unable to access other folder

we need to enable ftpuser to upload file into it
since i locking it to web directory, i set the owner to apache

     # chown apache:apache ftpuser

now add ftpuser to belong to apache group

     # useradd -G apache ftpuser

DONE
now you can try ftp into it

note 1
add this line to force active mode
pasv_enable=NO

No comments:

Post a Comment