sftp – SSH File Transfer Protocol

sftp (SSH File Transfer Protocol) provides secure, interactive file transfer capabilities over SSH. Unlike scp,...

Networking Tools Linux Open Source

sftp (SSH File Transfer Protocol) provides secure, interactive file transfer capabilities over SSH. Unlike scp, sftp offers an FTP-like interactive interface with commands for navigating directories, managing files, and performing batch transfers. It’s the recommended replacement for scp and traditional FTP.

The interactive nature of sftp makes it ideal for browsing remote filesystems, performing multiple operations in a session, and scripting complex file transfer workflows. Its security advantages over traditional FTP make it the standard for secure file transfer in modern environments.

Key Features

  • Interactive Mode – FTP-like command interface
  • Batch Mode – Script automated transfers
  • Resume Support – Continue interrupted transfers
  • Directory Operations – Create, remove, list directories
  • File Management – Rename, delete, change permissions
  • SSH Security – Full encryption and authentication

Basic Usage Examples

# Connect to remote server
sftp user@server

# Interactive commands
sftp> ls           # List remote files
sftp> lls          # List local files
sftp> cd /path     # Change remote directory
sftp> lcd /local   # Change local directory
sftp> get file.txt # Download file
sftp> put file.txt # Upload file
sftp> mget *.log   # Download multiple files
sftp> mput *.txt   # Upload multiple files
sftp> quit         # Exit

# Direct file transfer
sftp user@server:/path/file.txt

# Batch mode
sftp -b commands.txt user@server

Use Cases

  • Secure File Sharing – Replace insecure FTP
  • Remote Administration – Manage files on servers
  • Automated Transfers – Scripted batch operations
  • Backup Operations – Transfer backup files securely

View Documentation

Was this article helpful?