FTP, SFTP and rsync

A server needs your files. FTP, the File Transfer Protocol, predates the web and still appears in shared-hosting control panels, but it sends your username, password and files as plain text. Browsers dropped it (Chrome 95 1 and Firefox 90 555 , both in 2021), and you should too, unless a host offers nothing else. The names are easy to confuse:

File transfer protocols compared
Protocol Port Encryption Use it for
FTP 21 (+ data ports) None Nothing new
FTPS 21 or 990 TLS Hosts without SSH
SFTP 22 SSH Interactive and GUI clients
scp 22 SSH Quick one-off copies
rsync 13,872 over SSH 22 SSH Deploys (changes only)

FTPS is old FTP wrapped in TLS and needs its own server, such as vsftpd with ssl_enable=YES. SFTP is an entirely different protocol that runs inside SSH, so any server you can ssh into (Connecting to a Remote Machine) already supports it, with the same keys and the same firewall rule, and nothing else to install or open.

Copying files with sftp, scp and rsync, using the web1 host alias from Section 1.6.1
sftp web1                        # interactive: ls, cd, put index.html, get logs/access.log
scp index.html web1:/var/www/mysite/     # one file; add -r for a folder
# Mirror the build folder: -a keep permissions and times, -z compress, -v list files,
# --delete remove server files that no longer exist locally. Try --dry-run first.
rsync -avz --delete --dry-run dist/ web1:/var/www/mysite/
rsync -avz --delete dist/ web1:/var/www/mysite/

The trailing slash on dist/ matters: it copies the folder's contents; without it rsync creates /var/www/mysite/dist. Save the last command as deploy.sh or an npm 2,036 script ("deploy": "npm run build && rsync -avz --delete dist/ web1:/var/www/mysite/") and a release takes one command.

For drag-and-drop, FileZilla 4,598 (https://filezilla-project.org/ 4,598 ) (Windows, macOS, Linux) and WinSCP 14,725 (https://winscp.net/ 14,725 ) (Windows, GPL) speak SFTP as well as FTP and FTPS; choose SFTP and port 22 in the connection dialog. VS Code 550 's Remote - SSH extension goes further and lets you edit files on the server directly. On Windows, sftp and scp come with the built-in OpenSSH 23,707 client; run rsync from WSL 6 .