Creating a FTP user for a specific folder in linux

If you want to allow FTP connections to your linux machine and create username / password for a user and restrict the user to a specific folder when he/she logs in using the ftp client, you can follow the below steps.

First of all, you should have an FTP server setup. You can install vsftpd server in linux, using apt-get or yum depending on your distribution. Once done, you follow the below steps.

#1. Create a normal linux user for eg. Tom
useradd tom
passwd tom

#2. to prevent the ssh login. 
usermod -s /sbin/nologin tom

#3. restrict access to a particular folder
usermod -d /home/tom tom

#4. change settings in vsftpd config

vim /etc/vsftpd/vsftpd.conf

#5. comment below line in that file
#connect_from_port_20=YES

#6. make sure this is changed to YES
pasv_enable=YES
pasv_min_pz

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.