Run an SFTP Server on Android
AnExplorer's SFTP Server turns your Android phone into an SSH-accessible file server. Connect from any SSH/SFTP client on a laptop, desktop, or remote server — your phone's storage is securely exposed over the network.
Unlike the basic FTP Server, SFTP is encrypted over SSH. Every file transfer is protected, making SFTP Server appropriate for accessing your phone remotely over the internet or on untrusted networks.
When to Use SFTP Server Instead of FTP Server
| Situation | Use |
|---|---|
| Home Wi-Fi, trusted network | FTP Server (simpler) |
| Public Wi-Fi, office, or remote access | SFTP Server (encrypted) |
| Automating backups from a PC/server to phone | SFTP Server |
Another developer needs to scp files to your phone | SFTP Server |
Connecting from a Linux/Mac terminal via sftp or scp | SFTP Server |
How to Start the SFTP Server
- Open AnExplorer
- Open the menu sidebar (tap ≡ or swipe right)
- Select SFTP Server
- Tap Start
- AnExplorer shows: Host: 192.168.x.x, Port: 2222 (or your configured port)
- Set a username and password in the SFTP Server settings — never leave an SFTP server open without credentials
The server only runs while AnExplorer is active. It shuts down when you close the app or the system kills it to free memory.
Connecting from a Computer
From Windows (command prompt or PowerShell):
sftp -P 2222 [email protected]
Then use SFTP commands: ls, get filename, put filename, exit
From Linux or Mac (terminal):
sftp -P 2222 [email protected]
From FileZilla (Windows/Mac/Linux):
- Site Manager > New Site
- Protocol: SFTP – SSH File Transfer Protocol
- Host:
192.168.1.105, Port:2222 - Logon type: Normal, username, password
- Connect
From Cyberduck (Mac):
- Open Connection > SFTP (SSH File Transfer Protocol)
- Server:
192.168.1.105, Port:2222 - Enter username and password
Automating: Pull Phone Files from a Linux Server
A common workflow for developers: automatically back up phone contents to a Linux home server using a cron job:
# cron entry (runs every night at 2am)
0 2 * * * sftp -P 2222 [email protected]:/sdcard/DCIM /backup/phone-photos/
Or use rsync over SSH (if the phone SFTP server supports rsync commands — varies by implementation):
rsync -avz -e "ssh -p 2222" [email protected]:/sdcard/ /backup/phone/
This is a reliable way to maintain an automatic photo/video backup from phone to NAS or home server without any cloud service.
SFTP Server Settings
| Setting | Recommendation |
|---|---|
| Port | 2222 (default, avoids conflict with system SSH on port 22) |
| Username | Choose something non-trivial |
| Password | Use a strong password |
| Root directory | Restrict to /sdcard/ or a specific folder |
| SSH key auth | Available for key-based clients |
Security: SFTP Port Exposure
The SFTP Server binds to your phone's current IP on the local network by default. If you want to access it from outside your home:
- Enable port forwarding on your router: forward external port → phone IP port 2222
- Use your router's public IP or DDNS hostname to connect remotely
- Always use a password when exposing SFTP to the internet
- Consider a VPN (OpenVPN) instead of port-forwarding for better security
SFTP Server vs FTP Server vs Device Connect
| SFTP Server | FTP Server | Device Connect | |
|---|---|---|---|
| Encrypted | ✅ | ❌ | ❌ |
| Requires SSH client | ✅ | ❌ | ❌ |
| Works from any browser | ❌ | ❌ | ✅ |
| Best for | Remote/secure access | LAN transfers | Quick sharing |
| Related guide | This page | FTP Server | Device Connect |
Related Guides
- SFTP client — connect to remote servers
- FTP Server — simpler LAN server
- Device Connect — HTTP server for browsers
- Transfer from Android to PC
