Skip to content
Log In Sign Up [email protected]

Connect to the Server

From a terminal on your computer:

sftp user@your_server_ip

If SSH listens on another port, use capital -P. To use a specific key, add -i:

sftp -P 2222 -i ~/.ssh/id_ed25519 user@your_server_ip

After you log in, the prompt changes to sftp>. You are now working with two folders at once: the remote one on the server and the local one on your computer.

Move Around

On the serverOn your computerWhat it does
pwdlpwdShows the current folder.
lsllsLists files.
cd /var/wwwlcd ~/DownloadsChanges folder.
mkdir backupslmkdir backupsCreates a folder.

Commands that start with l act on the local side.

Upload and Download

CommandWhat it does
put index.htmlUploads a file from the local folder to the remote folder.
put -r siteUploads a folder and its contents.
get error.logDownloads a file from the remote folder to the local folder.
get -r logsDownloads a folder and its contents.
reput big.iso / reget big.isoResumes an interrupted upload or download.

Manage Files on the Server

  • rename old.txt new.txt: renames or moves a file.
  • rm file.txt: deletes a file. rmdir deletes an empty folder.
  • chmod 644 file.php: changes permissions.
  • df -h: shows free space on the server.
  • bye: closes the session. exit and quit do the same.

Graphical SFTP Clients

If you prefer drag and drop, FileZilla, WinSCP, and Cyberduck all speak SFTP. Choose SFTP as the protocol, enter the server address, port 22 (or your custom SSH port), user name, and either the password or your private key.

SFTP, FTP, and FTPS Compared

SFTPFTPFTPS
EncryptionAlways, through SSHNone; passwords travel in plain textTLS, when enabled
Port22, one connection21 plus separate data ports21 or 990 plus data ports
LoginPassword or SSH keyPasswordPassword, optional certificate
Extra software on a Linux serverNoneAn FTP serverAn FTP server with a certificate
Firewall setupOne portSeveral portsSeveral ports

Despite the similar names, SFTP is not FTP over SSH and has nothing in common with FTPS: it is a separate protocol that happens to do the same job.

Give a User File Access Only

A user who should upload files but never run commands can be limited to SFTP. In /etc/ssh/sshd_config, a Match User block with ForceCommand internal-sftp and ChrootDirectory keeps that user inside one folder. The chroot folder must be owned by root and not writable by the user, with a writable subfolder inside for uploads.

For a single one-off copy, scp is quicker than opening an SFTP session.

Updated:

Linux VPS with Full Root Access

MUVCloud cloud servers run on KVM with Enterprise NVMe SSD storage and full root access, in Turkey, the Netherlands, and the USA.

Cloud VPS Plans Starting at2.99 $/mo Cheap Linux VPS

No Limits on Service or Support

You are not on your own as your projects grow. Our support engineers are ready 24/7, on several channels, whenever you need them.

Support specialist
  • 100% customer satisfaction goal
  • Our own hardware
  • 24/7 ticket and email support
  • 4 countries with locations