Linux Tutorials - Herong's Tutorial Examples - v5.45, by Herong Yang
Setup FTP Sub-Directory for Local Users
This section provides a tutorial example on how to setup 'ftp' sub-directory for local users and allow them upload and download files using vsftpd on CentOS systems.
With the vsftpd configuration presented in the previous tutorial, I am ready to create a "ftp" directory structure under my home directory for my to upload and download files.
1. Create ~/ftp sub-directory as my FTP home directory. Its ownership and permissions are changed to allow "vsftpd" to access.
herong$ sudo mkdir /home/herong/ftp herong$ sudo chown nobody:nobody /home/herong/ftp herong$ sudo chmod a-w /home/herong/ftp herong$ sudo ls -l /home/herong ... dr-xr-xr-x 2 nobody nobody 6 Jun 23 17:03 ftp
2. Create ~/ftp/files sub-directory with private access for uploading and downloading files.
herong$ sudo mkdir /home/herong/ftp/files herong$ sudo chown herong:herong /home/herong/ftp/files herong$ sudo ls -lah /home/herong/ftp/ dr-xr-xr-x 3 nobody nobody 19 Jun 23 17:08 . drwx------ 3 herong herong 94 Jun 23 17:07 .. drwxr-xr-x 2 herong herong 6 Jun 23 17:08 files
3. Add myself to the vsftpd allowed user list. Note that I am using "user_list" as the allowed user list, different than the default setting. So I have to remove all other users in this file.
herong$ cd /etc/vsftpd herong$ sudo cp user_list user_list.bck herong$ sudo vi user_list # vsftpd userlist # If userlist_deny=NO, only allow users in this file # If userlist_deny=YES (default), never allow users in this file, and # do not even prompt for a password. # Note that the default vsftpd pam config also checks /etc/vsftpd/ftpusers # for users that are denied. herong
4. Restart vsftpd server:
herong$ sudo systemctl restart vsftpd
My FTP access is ready. See next tutorial on how to test FTP access locally.
Table of Contents
Cockpit - Web Portal for Administrator
SELinux - Security-Enhanced Linux
SSH Protocol and ssh/scp Commands
Software Package Manager on CentOS - DNF and YUM
►vsftpd - Very Secure FTP Daemon
►Setup FTP Sub-Directory for Local Users
Test FTP Access Locally on CentOS
Test FTP Access Remotely on CentOS
Support FTP Over TLS on CentOS
Disable SSH Access for FTP Users