How to Connect to Your VDS Server via SSH (Complete Guide)
Step-by-step SSH connection guide for Linux VDS: PuTTY, Terminal, key-based authentication, Path Panel firewall rules, and security best practices.
Complete guide to SCP syntax, SFTP interactive mode, rsync for sync and backup, and WinSCP/FileZilla for Windows users. Secure file transfer to Linux servers.
There are multiple secure methods for transferring files to your Linux server. SCP (Secure Copy Protocol), SFTP (SSH File Transfer Protocol), and rsync all use SSH infrastructure to provide encrypted file transfer. This guide covers all three tools and graphical alternatives for Windows users.
SCP is a simple and fast tool for copying files over SSH.
# Copy local file to server
scp /local/file.txt user@server-ip:/remote/directory/
# Copy from server to local machine
scp user@server-ip:/remote/file.txt /local/directory/
# Copy directory (-r recursive)
scp -r /local/directory/ user@server-ip:/remote/directory/
# Custom port (-P uppercase)
scp -P 2222 file.txt user@server-ip:/destination/
# With SSH key file
scp -i ~/.ssh/id_rsa file.txt user@server-ip:/destination/
# Copy between two remote servers
scp user1@server1:/file.txt user2@server2:/destination/
# Transfer with compression (-C)
scp -C large-file.tar.gz user@server-ip:/destination/
# Show progress (-v verbose)
scp -v file.txt user@server-ip:/destination/
# Limit bandwidth (KB/s)
scp -l 1024 file.txt user@server-ip:/destination/
# Multiple files
scp file1.txt file2.txt user@server-ip:/destination/
# With wildcard
scp *.log user@server-ip:/var/log/backup/
SCP is ideal for simple file copying. For large directory synchronization or backups, rsync is more efficient.
SFTP is a full-featured file transfer protocol running over SSH. It's the secure alternative to FTP.
# Start SFTP session
sftp user@server-ip
# With custom port
sftp -P 2222 user@server-ip
# With SSH key
sftp -i ~/.ssh/id_rsa user@server-ip
Commands available once an SFTP session is open:
# List remote directory
ls
ls -la
# Change remote directory
cd /var/www/html
# Change local directory
lcd ~/Downloads
# Show current remote directory
pwd
# Show current local directory
lpwd
# Upload file (local → remote)
put file.txt
put file.txt /destination/directory/
# Upload directory
put -r /local/directory/ /remote/directory/
# Download file (remote → local)
get file.txt
get /remote/file.txt ~/Downloads/
# Download directory
get -r /remote/directory/ /local/directory/
# Create remote directory
mkdir new-directory
# Delete remote file
rm file.txt
# Move/rename remote file
rename old-name.txt new-name.txt
# Close SFTP session
exit
quit
# SFTP in batch mode (with script)
sftp -b - user@server-ip << 'EOF'
cd /var/www/html
put index.html
put style.css
put app.js
EOF
# With batch file
cat > sftp-commands.txt << 'EOF'
cd /var/www/html
put -r ./dist/
EOF
sftp -b sftp-commands.txt user@server-ip
rsync is a powerful tool for efficiently synchronizing files and directories. It only transfers changed files.
# Sync local directory to server
rsync -avz /local/directory/ user@server-ip:/remote/directory/
# Sync from server to local machine
rsync -avz user@server-ip:/remote/directory/ /local/directory/
# With custom SSH port
rsync -avz -e "ssh -p 2222" /local/ user@server-ip:/remote/
# With SSH key
rsync -avz -e "ssh -i ~/.ssh/id_rsa" /local/ user@server-ip:/remote/
# -a: archive (recursive + permissions + timestamps + symlinks)
# -v: verbose output
# -z: compress during transfer
# -h: human-readable sizes
# -P: progress + partial (resume interrupted transfers)
# --delete: delete files not in source
# --dry-run: simulate without actual transfer
# --exclude: exclude specific files
# Full backup command
rsync -avzh --progress /var/www/ user@server-ip:/backup/www/
# Sync including deletions
rsync -avz --delete /local/ user@server-ip:/remote/
# Simulate first
rsync -avz --dry-run /local/ user@server-ip:/remote/
# Exclude specific files
rsync -avz --exclude='*.log' --exclude='.git' /local/ user@server-ip:/remote/
# Limit bandwidth (KB/s)
rsync -avz --bwlimit=1024 /local/ user@server-ip:/remote/
# Daily backup with cron
crontab -e
# Backup every night at 02:00
0 2 * * * rsync -avz --delete /var/www/ user@backup-server:/backup/www/ >> /var/log/rsync-backup.log 2>&1
# Dated backup
rsync -avz /var/www/ user@server-ip:/backup/www-$(date +%Y%m%d)/
rsync's most powerful feature is its delta transfer algorithm: it only transfers changed blocks. If a small part of a large file changes, rsync only sends that changed portion, saving significant bandwidth.
WinSCP is the most popular SFTP/SCP client for Windows.
Installation and Connection:
WinSCP Features:
FileZilla is a cross-platform SFTP client for Windows, macOS, and Linux.
Setting Up Connection:
# Edit ~/.ssh/config
nano ~/.ssh/config
Host my-server
HostName 203.0.113.50
User ubuntu
Port 22
IdentityFile ~/.ssh/id_rsa
ServerAliveInterval 60
# Now connect with short alias
scp file.txt my-server:/destination/
sftp my-server
rsync -avz /local/ my-server:/remote/
# Test SSH connection
ssh -v user@server-ip
# Check port
nmap -p 22 server-ip
# Check firewall
sudo ufw status
# Check destination directory permissions
ls -la /destination/directory/
# Fix permissions if needed
sudo chmod 755 /destination/directory/
sudo chown user:user /destination/directory/
SCP, SFTP, and rsync are essential tools for secure file transfer to Linux servers. Use SCP for simple copying, SFTP for interactive management, and rsync for synchronization and backups. Windows users can access the same functionality through WinSCP or FileZilla's graphical interfaces.
SCP is a simple, fast tool for file copying — it only copies. SFTP is a full-featured file management protocol: it supports creating directories, deleting, renaming, and interactive sessions. Use SCP for simple copying, SFTP for full file management.
rsync uses a delta transfer algorithm: it only transfers changed blocks of files. If a small part of a large file changes, rsync only sends that changed portion. SCP copies the entire file every time.
On Windows, use WinSCP or FileZilla. Both support the SFTP protocol and allow SSH key authentication. WinSCP offers more advanced features while FileZilla stands out with cross-platform support.
First simulate with '--dry-run': 'rsync -avz --dry-run --delete /source/ /destination/'. This shows what would happen without actually transferring. If you're satisfied with the results, run without '--dry-run'.
With rsync using the '-P' (--partial --progress) option, an interrupted transfer resumes from where it left off. With SCP, you need to restart the transfer from the beginning. This is why rsync is preferred for large files.
Step-by-step SSH connection guide for Linux VDS: PuTTY, Terminal, key-based authentication, Path Panel firewall rules, and security best practices.
Complete guide to connecting to Windows Server VDS via Remote Desktop (RDP): setup steps, NLA security, Path Panel firewall rule, and troubleshooting tips.
Step-by-step guide to changing your VDS server OS via REXE panel: backup tips, supported Linux distributions and Windows Server versions explained.