Set up FTP server in linux

Published: by

Install FTP server in linux

Debian

sudo apt install vsftpd

Fedora

sudo yum install vsftpd

Open FTP ports

If you have UFW enabled, in order to allow access to FTP services from remote machines you have to open ports 20 and 21 by adding new firewall rules as follows:

sudo ufw allow 20/tcp
sudo ufw allow 21/tcp

Configuring FTP Server

Modify the file /etc/vsftpd.conf, there are many options like enabling anonymous read/write access, etc.

To change the root directory of ftp server, change the following variables :

  • local_root=/path_to_new_ftp_dir/ For local user
  • anon_root=/path_to_new_ftp_dir/ For anonymous user