How to Set Up an FTP on a VPS Print

  • 0

Setting up an FTP (File Transfer Protocol) server on a VPS enables efficient file transfers for website management, backups, or sharing. This guide provides a concise setup process using vsftpd on a Linux VPS, with VPS.DO elements for context.

Prerequisites

  • A VPS with root access (e.g., VPS.DO’s 1H2G plan with Ubuntu 20.04/22.04).
  • An FTP client (e.g., FileZilla, WinSCP).
  • Basic SSH knowledge.

Step-by-Step Setup

1. Connect to Your VPS

Access your VPS via SSH using credentials from VPS.DO’s SolusVM control panel:

ssh root@your_vps_ip

2. Install vsftpd

Install the vsftpd server for secure and lightweight FTP:

sudo apt update && sudo apt install vsftpd -y  # Ubuntu/Debian
sudo yum install vsftpd -y                    # CentOS
sudo systemctl start vsftpd
sudo systemctl enable vsftpd

3. Configure vsftpd

Edit the vsftpd configuration file:

sudo nano /etc/vsftpd.conf

Add or modify these settings:

anonymous_enable=NO
local_enable=YES
write_enable=YES
chroot_local_user=YES
allow_writeable_chroot=YES

Save and restart vsftpd:

sudo systemctl restart vsftpd

4. Create an FTP User

Add a dedicated FTP user:

sudo useradd -m ftpuser -s /bin/bash
sudo passwd ftpuser

Set a strong password for ftpuser.

5. Secure the FTP Server

  • Firewall: Allow FTP ports (20, 21) using UFW:
    sudo ufw allow 20,21/tcp
    sudo ufw enable
    
  • SFTP Recommendation: For enhanced security, consider SFTP (port 22) instead of FTP, as it encrypts data. Most FTP clients support SFTP.

6. Test FTP Access

Use an FTP client (e.g., FileZilla):

  • Host: Your VPS IP (e.g., 192.0.2.1)
  • Username: ftpuser
  • Password: The password set above
  • Port: 21 (FTP) or 22 (SFTP)
    Connect and upload a test file to /home/ftpuser. Verify access.

7. Monitor and Troubleshoot

  • Check logs for issues:
    sudo tail -f /var/log/vsftpd.log
    
  • Use VPS.DO’s SolusVM panel to monitor CPU and RAM to ensure FTP operations don’t strain resources.
  • If connection fails, verify firewall settings and user permissions.

Conclusion

Setting up an FTP server on a VPS is straightforward with vsftpd, enabling efficient file management. VPS.DO’s full root access and NVMe SSDs ensure fast and reliable performance. For security, prioritize SFTP and monitor resources to maintain smooth operations.


Was this answer helpful?

« Back