ShellSage
ShellSage mobile SFTP file transfer workflow
SSH BASICS

Using SSH for FTP File Transfers: A Practical Guide

Learn how to securely transfer files using SSH instead of traditional FTP.


Yes, you can use SSH for FTP file transfers by utilizing SFTP, a secure alternative that operates over SSH to provide encrypted file transfers.

What is SFTP and How Does It Work?

SFTP, or Secure File Transfer Protocol, is a secure version of FTP that operates over SSH (Secure Shell). Unlike traditional FTP, which sends data in plaintext and is vulnerable to interception, SFTP encrypts both commands and data, ensuring a high level of security. When you use SFTP, you are essentially using the SSH protocol to move files between systems, which not only secures the transfer but also provides additional functionalities like file manipulation and directory listings.

To initiate an SFTP session, you connect to the remote server using SSH credentials. This means you need a valid username and password, or a set of SSH keys if you're using key-based authentication. Once connected, you can execute commands similar to those in a regular FTP session, such as listing files, uploading, and downloading.

SFTP encrypts both commands and data, providing a secure method for file transfers.

One of the key benefits of using SFTP over SSH is that it utilizes the same port as SSH, typically port 22, which simplifies firewall configurations. This is particularly advantageous in environments where network security policies are stringent.

How to Transfer Files Using SFTP

Transferring files using SFTP is straightforward. Most Linux distributions come with the sftp command-line tool pre-installed. Here’s a step-by-step guide on how to use it:

  1. Open your terminal: Launch your terminal application.
  2. Connect to the remote server: Use the command sftp user@host to establish a connection. Replace user with your username and host with the server's address.
  3. Authenticate: Enter your password or use an SSH key if prompted.
  4. Navigate directories: Use ls to list files and cd to change directories.
  5. Transfer files: Use put localfile to upload and get remotefile to download files.
sftp user@host
put localfile.txt
get remotefile.txt
exit

This will securely transfer your files between the local and remote machines. If you’re managing multiple transfers or need to automate the process, consider using batch files or scripts with SFTP commands.

Use SFTP for secure file transfers over SSH, especially in environments with strict security policies.

Can SSH Clients on Mobile Handle SFTP?

Yes, mobile SSH clients can handle SFTP, but the experience varies significantly between different apps. Traditional mobile SSH clients like Termius and JuiceSSH provide basic SSH and SFTP functionalities. However, they often require manual command input, which can be cumbersome on a mobile device.

ShellSage, on the other hand, enhances this experience with features specifically designed for mobile use. Its AI assistant, Sage, can explain command outputs and suggest corrections, reducing the likelihood of errors. The app also supports voice input, making it easier to execute commands without typing on a small screen. Moreover, ShellSage offers a blast-radius preview, which helps you understand the impact of your commands before executing them, adding an extra layer of safety when managing files on the go.

In contrast, while Termius and JuiceSSH are robust for basic connections, they don't offer these AI-driven capabilities or the same level of user-friendly interaction that ShellSage provides.

Setting Up SSH Keys for SFTP

While password authentication works for SFTP, using SSH keys is a more secure and convenient method. SSH keys consist of a pair of cryptographic keys: a private key that you keep secure on your device, and a public key that you place on the server.

To set up SSH keys, follow these steps:

  1. Generate the keys: Use ssh-keygen -t rsa -b 2048 to generate a new key pair.
  2. Copy the public key: Transfer it to the server using ssh-copy-id user@host.
  3. Verify the setup: Attempt to connect using sftp user@host without a password prompt.
ssh-keygen -t rsa -b 2048
ssh-copy-id user@host
sftp user@host

SSH keys not only enhance security but also streamline the connection process, especially useful when managing multiple remote servers.

When Should You Use SFTP Over Other Protocols?

SFTP is ideal in scenarios where security is paramount. If you're transferring sensitive data or operating in a regulated industry, SFTP should be your go-to protocol due to its encryption capabilities. Additionally, if you need to bypass restrictive firewalls, SFTP simplifies this by using the SSH port.

Compared to FTP and FTPS, SFTP is more secure and generally easier to configure, as it doesn't require additional ports for data transfer. In environments where you have SSH access but no FTP access, SFTP is the natural choice.

For mobile users, especially those on the go, ShellSage makes SFTP even more accessible by providing an intuitive interface and AI-powered assistance, which is not typically available in other mobile SSH clients.

⚡ Key takeaways

Sam Okonkwo
Your Questions, Answered

Frequently Asked Questions

You can transfer files over SSH using the Secure File Transfer Protocol (SFTP), which provides encrypted file transfers between systems. SFTP uses SSH credentials for authentication and allows you to perform file operations securely. With ShellSage, you can easily initiate SFTP sessions from your phone, benefiting from voice input and AI assistance for smooth file management.
Yes, you can use an SSH terminal on a phone to remotely access and manage servers. Mobile apps like ShellSage enable this functionality by providing a user-friendly interface and features like voice input and an AI assistant to enhance your SSH experience on the go.
SFTP, or Secure File Transfer Protocol, is a secure version of FTP that operates over SSH, encrypting both commands and data for secure file transfers. It requires SSH credentials for authentication, allowing for secure file manipulation and directory listings. ShellSage facilitates SFTP sessions on mobile devices, offering a seamless and secure way to manage files remotely.
ShellSage offers a free version with basic features, allowing users to access SSH and SFTP functionalities on their phones. For advanced features and enhanced capabilities, there may be premium options available.
ShellSage requires an internet connection to establish SSH and SFTP sessions, as these protocols operate over the network. However, once connected, it can cache certain data locally to improve performance and user experience.
Two layers, and it is worth being exact about both. On your phone the private key is held in encrypted secure storage behind an optional biometric gate. On the server, every host you save has its key or password stored encrypted at rest (AES-256), which is how a new phone picks up your servers without re-entering anything. That means it is encryption at rest rather than end-to-end: the server can decrypt the secret and hands it back to the app when you connect. Your commands, terminal scrollback and voice audio are never stored on ShellSage's servers, and deleting a host removes its stored credential.
Download ShellSage free
ShellSage is an AI-first SSH terminal with Sage built in: it explains output, fixes broken commands, and previews the blast radius before anything runs. Start on the free Hobby plan with no credit card, and get a 7-day full-Pro trial when you want everything.
← More tutorials