ShellSage
ShellSage mobile SFTP file transfer workflow
SSH BASICS

How to Upload a File Through SSH: A Step-by-Step Guide

Learn how to upload files using SSH with detailed commands and examples.


To upload a file through SSH, you can use SCP (Secure Copy Protocol) or SFTP (SSH File Transfer Protocol). Both methods ensure secure data transmission over SSH.

What is SCP and How Do You Use It?

The Secure Copy Protocol (SCP) is a simple and effective way to transfer files between hosts over SSH. It encrypts the files and any passwords exchanged, ensuring your data remains secure. The basic syntax for uploading a file using SCP is:

scp /path/to/local/file user@remote_host:/path/to/remote/directory

Let's break down this command:

For example, to upload a file named example.txt from your local machine to the /home/user/docs directory on a server at 192.168.1.10, you would use:

scp example.txt user@192.168.1.10:/home/user/docs
SCP is straightforward and widely supported, making it a go-to for quick file transfers.

Remember that SCP will overwrite files in the destination directory with the same name, so ensure you're directing your uploads correctly.

How to Use SFTP for File Uploads

SFTP, or SSH File Transfer Protocol, is another secure method for transferring files. It offers more functionality than SCP, such as directory listings and file management capabilities. To start an SFTP session, use the command:

sftp user@remote_host

Once connected, you'll see an SFTP prompt, typically sftp>. You can now upload files using the put command:

put /path/to/local/file /path/to/remote/directory

For instance, if you want to upload example.txt to the /home/user/docs directory, you would enter:

put example.txt /home/user/docs
SFTP provides a more interactive experience, allowing navigation and batch transfers.

SFTP can be particularly useful when managing multiple files or needing to navigate directories on the remote server.

When Should You Use SCP vs. SFTP?

Choosing between SCP and SFTP depends on your specific needs. SCP is ideal for simple, quick file transfers where you don't need to interact with the remote file system extensively. It's straightforward, quick to set up, and efficient for single file uploads.

SFTP, on the other hand, is more suited for scenarios where you need to manage files on the remote server, such as moving directories, renaming files, or batch uploads. Its interactive nature provides more control and flexibility.

For mobile SSH clients, like Termius or JuiceSSH, users often have to manually enter these commands, which can be cumbersome on a small screen. ShellSage simplifies this with voice input and a blast-radius preview, ensuring you execute the right command without mistakes.

How Does ShellSage Enhance SSH File Uploads on Mobile?

Most mobile SSH clients, like Termius and JuiceSSH, require manual command input for file transfers, which can be tedious. ShellSage improves this experience by providing an AI assistant named Sage. Sage can explain command outputs, suggest corrections, and even allow you to use voice commands, making file uploads seamless on your phone.

Moreover, ShellSage offers a blast-radius preview feature, which is particularly useful for ensuring that your commands won't have unintended consequences. This feature is not typically found in other clients and provides an extra layer of confidence when executing commands.

With ShellSage, you can also leverage real SFTP capabilities on your phone, making it easier to manage files on the go without the need for a full desktop setup.

Tips for Secure and Efficient File Uploads

When uploading files over SSH, security and efficiency are paramount. Here are some tips to keep in mind:

By following these practices, you can ensure your file transfers are both secure and efficient.

⚡ Key takeaways

Marcin Migdal
Your Questions, Answered

Frequently Asked Questions

You can transfer files over SSH using SCP or SFTP. SCP is straightforward for single files, while SFTP offers more interactive control. ShellSage enhances this with mobile-friendly features.
Yes, you can use an SSH terminal app on a phone. ShellSage offers a mobile SSH client with AI assistance, voice inputs, and real SFTP capabilities.
Use SCP or SFTP to upload files over SSH. SCP is ideal for quick transfers, while SFTP allows more interactive file management. ShellSage simplifies this on mobile devices.
ShellSage offers a free tier with essential features. Advanced features like AI assistance and blast-radius previews may require a subscription.
ShellSage requires an internet connection for SSH and SFTP operations. However, some local features may be available offline.
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.
Yes, ShellSage supports multiple file uploads through its SFTP functionality, making it easy to manage files on your mobile device.
ShellSage offers unique features like AI assistance, voice input, and a blast-radius preview, which are not typically found in other SSH clients like Termius or JuiceSSH.
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