Blog 10-21-25
1 SFTP
1.1 Common Uses of SFTP
SFTP is the industry standard for any situation where secure file transfer is needed:
Web Developers: To upload website files from their local computer to a web hosting server.
Financial and Healthcare Institutions: To exchange sensitive data like financial reports or patient records, often to meet compliance laws (e.g., HIPAA, PCI-DSS).
Businesses: To automate the transfer of payroll data, sales reports, or backups between offices or to cloud storage.
System Administrators: To securely manage files on remote servers.
1.2 Key Features of SFTP
Strong Encryption: All data is encrypted before being sent. This includes the files themselves, as well as your commands and passwords.
Authentication: You can authenticate with a simple username/password, or more securely using SSH keys (a pair of cryptographic keys that are much harder to crack than a password).
Single Connection: SFTP only requires a single connection (usually on port 22) for both commands and data. This makes it easier to configure through firewalls compared to FTP, which requires multiple ports.
File Management: It’s not just for transfers. You can use SFTP to browse directories, create, delete, and rename files, and change their permissions on the remote server.
1.3 SFTP vs. FTPS: A Common Point of Confusion
It’s important not to confuse SFTP with FTPS.
SFTP: A completely different protocol that runs over an SSH connection.
FTPS: This is the traditional FTP protocol, but with a SSL/TLS encryption layer added on top (the same technology that secures HTTPS websites).
While both are secure, SFTP is generally considered simpler and more modern due to its use of a single connection.
Summary
| Feature | FTP | SFTP |
|---|---|---|
| Security | Insecure (plain text) | Highly Secure (encrypted) |
| Encryption | None | SSH (Secure Shell) |
| Port | 21 | 22 |
| Connection | Multiple ports | Single port |
| Authentication | Username/Password | Username/Password or SSH Keys |
In short: If you need to transfer files securely, you should always use SFTP (or a modern alternative) and avoid the older, insecure FTP.
1.4 Changing the default SSH port
Edit the config:
sudo nano /etc/ssh/sshd_config
Allow the port through firewall:
sudo ufw allow 2222/tcp
See if SSH is listening on any ports
sudo netstat -tlnp | grep :22
sudo netstat -tlnp | grep :2222
Reload the systemd daemon and restarted the socket:
sudo systemctl daemon-reload # Reload systemd configuration
sudo systemctl restart ssh.socket # Restart the socket listener
Check if something else is using port 2222 that might conflict:
sudo ss -tlnp | grep :2222
1.5 Configure Rclone to connect to VPS via SFTP
1.5.1 Create a New SFTP Remote
Run the configuration wizard:
rclone config
You’ll see an interactive prompt. Follow these steps:
e) Edit existing remote
n) New remote
s) Set configuration password
q) Quit config
Choose n for New remote.
1.5.2 Configure the SFTP Connection
name> VPS
For storage type, choose SFTP:
Type of storage to configure.
Choose a number from below, or type in your own value
...
50 / SFTP
...
Storage> 50
List the root directory of your VPS:
rclone lsd vps:
Copy files TO your VPS:
rclone copy D:\TestVPS\ VPS:TestVPS -P
This will create ~/TestVPS in the user’s home directory, where they have write permissions.
1.5.3 Automated Two-Way Sync Scripts
Sync TO VPS:
@echo off
echo Syncing local Obsidian to VPS...
rclone sync "D:\TestVPS\Obsidian" "VPS:TestVPS/Obsidian" -P --progress
echo Sync complete!
pause
Sync FROM VPS:
#!/bin/bash
echo "Syncing Obsidian vault..."
rclone sync ~/Obsidian VPS:TestVPS/Obsidian -P
echo "Sync complete!"