FTP and SFTP: Transfer Files to Server

01

FTP vs SFTP: Which to Use?

FTPSFTP
Security❌ Traffic in clear✅ Encrypted (via SSH)
Port2122 (same as SSH)
Server InstallationRequires vsftpd/ProFTPDAlready included in OpenSSH
FirewallProblems with passive modeNo problems
RecommendedPrivate networks only✅ Always

Always use SFTP when possible. FTP sends username and password in clear.

02

SFTP (No Configuration Needed)

If SSH works on server, SFTP already works: uses same port and credentials.

From Terminal (Linux/Mac/WSL)

bash
# Basic connection
sftp root@185.100.xxx.xxx

# With custom port
sftp -P 2222 root@185.100.xxx.xxx

# With SSH key
sftp -i ~/.ssh/id_rsa root@185.100.xxx.xxx

Interactive SFTP commands:

ls # list remote files lls # list local files cd /var/www # change remote directory lcd ~/Desktop # change local directory get file.txt # download file put file.txt # upload file get -r /var/www/html # download entire directory put -r ./dist # upload entire directory mkdir new-dir # create remote directory rm file.txt # delete remote file exit # disconnect

With rsync (More Efficient for Large Transfers)

bash
# Upload folder (only modified files)
rsync -avz --progress ./dist/ root@185.100.xxx.xxx:/var/www/html/

# Download folder from server
rsync -avz root@185.100.xxx.xxx:/var/backups/ ./backup-local/

# With custom port
rsync -avz -e "ssh -p 2222" ./dist/ root@185.100.xxx.xxx:/var/www/html/
03

FTP with vsftpd (Ubuntu/Debian)

Use FTP only if necessary (e.g. CMS or software that doesn't support SFTP).

Installation

bash
sudo apt install vsftpd -y

Secure Configuration

bash
sudo nano /etc/vsftpd.conf

Recommended configuration:

ini
# Enable write
write_enable=YES

# Local users (no anonymous)
local_enable=YES
anonymous_enable=NO

# Chroot: each user sees only their home
chroot_local_user=YES
allow_writeable_chroot=YES

# Passive mode (needed if firewall/NAT)
pasv_enable=YES
pasv_min_port=40000
pasv_max_port=50000

# SSL/TLS (FTP over TLS = FTPS)
ssl_enable=YES
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
force_local_data_ssl=YES
force_local_logins_ssl=YES
bash
sudo systemctl restart vsftpd
sudo systemctl enable vsftpd

Open Firewall Ports

bash
# FTP port + passive range
ufw allow 21/tcp
ufw allow 40000:50000/tcp

Create Dedicated FTP User (No SSH Access)

bash
# Create user without shell
sudo useradd -m -s /usr/sbin/nologin ftpuser
sudo passwd ftpuser

# Set home as FTP root
sudo chown ftpuser:ftpuser /home/ftpuser
04

FTP Server on Windows

To create FTP server on Windows Server:

  • Physical path: e.g. C:\inetpub\ftproot
  • Binding: port 21, no certificate (or SSL if available)
  • Authentication: Basic
  • Authorization: specific users in read/write
  • Server Manager → Add Roles and Features
  • Select: Web Server (IIS) → FTP Server → FTP Service
  • After installation: IIS Manager → Sites → Add FTP Site
  • Configure:
  • Open port 21 in Windows Firewall
05

Recommended FTP/SFTP Clients

ClientOSSFTPFTPNotes
FileZillaWin/Mac/LinuxFree, intuitive GUI
WinSCPWindowsPuTTY integration
CyberduckMac/WinFree, also cloud
TransmitMacPaid, very fast

Guide: PuTTY and FileZilla for detailed FileZilla setup.

DeluxHost, founded in 2023, offers high-quality hosting solutions for various digital needs. We provide shared hosting, VPS, and dedicated servers with advanced security and global data centers.

© DeluxHost, All rights reserved. | VAT Number : IT17734661006
All Systems Operational