SFTP on Android: transfer files to a server
SFTP lets you move files between an Android phone and any server that runs SSH, with nothing extra to install on the server. Open an SFTP client on the phone, connect with the same address, user name and password or key you use for SSH, then browse, download and upload files.
This guide covers the setup, the transfer steps, the command-line way, and the errors people hit most.
SFTP, FTP and SCP in one minute
- SFTP runs inside an SSH connection. It is encrypted, uses port 22, and is on by default wherever OpenSSH runs.
- FTP is a separate, older protocol. It needs its own server, and plain FTP sends passwords unencrypted.
- SCP also runs over SSH, but it copies files without letting you browse folders.
If you can SSH into a server, SFTP already works.
Step 1: Confirm SFTP is available on the server
On the server, check that the SFTP subsystem is configured:
grep -i subsystem /etc/ssh/sshd_config
You should see a line such as:
Subsystem sftp /usr/lib/openssh/sftp-server
or Subsystem sftp internal-sftp. Either is fine. If the line is commented out, remove the # and restart SSH with sudo systemctl restart ssh.
Step 2: Connect from the phone
Enter the same details you would use for SSH:
| Field | Example |
|---|---|
| Host | 192.168.1.30 or files.example.com |
| Port | 22 |
| User | deploy |
| Auth | password or private key |
You land in the user's home folder, for example /home/deploy.
Step 3: Download a file to the phone
- Browse to the folder, for example
/var/logor~/backups. - Select the file and choose download.
- Open it from the phone's storage once the transfer completes.
This is handy for grabbing a log, a database dump or a config file to read later or share.
Step 4: Upload a file from the phone
- Browse to the target folder on the server.
- Choose upload and pick a file from the phone.
- Wait for the transfer to finish before closing the app or leaving the network.
Uploads go wherever your user has write permission. For a web root such as /var/www/html you may need to change ownership first (see below).
The command-line way
If you are already in an SSH terminal, you can pull and push files with the built-in tools.
Copy a file from the server to another machine:
scp deploy@192.168.1.30:/home/deploy/report.csv .
Copy a whole folder:
scp -r deploy@192.168.1.30:/home/deploy/site ./site
Use the interactive sftp shell:
sftp deploy@192.168.1.30
sftp> ls
sftp> get report.csv
sftp> put notes.txt
sftp> bye
For large or repeated transfers, rsync only sends what changed:
rsync -avz ./site/ deploy@192.168.1.30:/var/www/site/
Fixing common SFTP errors
Permission denied on upload Your user cannot write to that folder. Check the owner:
ls -ld /var/www/html
Give your user access, for example:
sudo chown -R deploy:deploy /var/www/html
or add your user to the group that owns it.
Connection closed right after login
Something in the shell startup prints text (for example an echo in ~/.bashrc), which breaks the SFTP protocol. Wrap it so it only runs in interactive shells:
if [[ $- == *i* ]]; then echo "welcome"; fi
Timed out The phone cannot reach the server. Check the address, the firewall on port 22, and whether you are on the same network or VPN.
Doing it with ShellPilot
ShellPilot is an SSH client and SFTP file manager for Android that needs no account or sign-up. Your connections and keys stay on the phone.
- Save the server as a connection once, with a password or an Ed25519 or RSA SSH key.
- Open the SFTP file manager on that connection to browse remote folders.
- Browse and download remote files for free.
- With Pro, upload from the phone, rename, create folders and delete files.
- Mark favorite paths and use recent folders to get back to places like
/var/wwwor~/backupsin one tap. - Switch to the terminal on the same connection when you need
chown,rsyncortar.
FAQ
Is SFTP the same as FTP over SSL? No. FTP over SSL (FTPS) is FTP with encryption added and needs an FTP server. SFTP is part of SSH and needs no extra server software.
Can I use SFTP with a key instead of a password? Yes. SFTP uses the same login as SSH, so any key that works for SSH also works for SFTP.
How do I transfer a whole folder?
Compress it first on the server with tar -czf site.tar.gz site/, download the single archive, and extract it where you need it. Over a phone connection one archive is more reliable than hundreds of small files.