How to set up FTP server in Linux - Evoxt
Login
Register
We care about the Environment

How to set up FTP server in Linux

Step 1: Install vsftpd

To set up an FTP server in Linux, first, you have to ensure vsftpd is installed: For Ubuntu/Debian:
sudo apt update
sudo apt install vsftpd -y
For CentOS/RHEL:
sudo yum install vsftpd -y

Step 2: Basic Configuration of vsftpd

Configure vsftpd to allow basic FTP connections and set user restrictions.
  1. Open the vsftpd configuration file:
    sudo nano /etc/vsftpd.conf
  2. Edit/add the following settings for a secure FTP setup, the FTP folder in this case will be /home/$USER/FTP:
    anonymous_enable=NO
    local_enable=YES
    write_enable=YES
    chroot_local_user=YES
    allow_writeable_chroot=YES
    chroot_local_user=YES
    user_sub_token=$USER
    local_root=/home/$USER/ftp
    
  3. Save and close the file.
  4. Restart vsftpd to apply changes:
    sudo systemctl restart vsftpd

Step 3: Create FTP Users

To allow specific users to access the FTP server:
  1. Create a new user (replace <username> with the desired username):
    sudo adduser <username>
  2. Create an FTP upload directory for the user:
    sudo mkdir /home/<username>/ftp
    sudo chown <username> /home/<username>/ftp

Step 4: Test the FTP Server Configuration

To connect to the FTP server, use an FTP client like FileZilla:
  1. Open FileZilla
  2. Enter your server IP, username, and password, then click Connect.
 

Troubleshooting Tips

Check logs for errors:
sudo tail /var/log/vsftpd.log
 

Ctrl+C Sanctuary

The entire guide is distilled into copy-paste perfection—tested, hassle-free, and ready to go.   Ubuntu/ Debian Based :
sudo apt update
sudo apt install vsftpd -y
sudo echo -e "write_enable=YES\nchroot_local_user=YES\nallow_writeable_chroot=YES\nchroot_local_user=YES\nuser_sub_token=$USER\nlocal_root=/home/$USER/ftp" >> /etc/vsftpd.conf
sudo systemctl restart vsftpd
useradd -m ftpuser;echo "ftpuser:ftpuser" | chpasswd
sudo mkdir /home/ftpuser/ftp
sudo chown ftpuser /home/ftpuser/ftp
Fedora/ RHEL Based :
sudo dnf update -y
dnf install vsftpd -y
sudo echo -e "write_enable=YES\nchroot_local_user=YES\nallow_writeable_chroot=YES\nchroot_local_user=YES\nuser_sub_token=$USER\nlocal_root=/home/$USER/ftp" >> /etc/vsftpd.conf
sudo systemctl restart vsftpd
useradd -m ftpuser;echo "ftpuser:ftpuser" | chpasswd
sudo mkdir /home/ftpuser/ftp
sudo chown ftpuser /home/ftpuser/ftp

High CPU Frequency Virtual Machines

Available Globally

Starting at

$2.99

Deploy now