What's the Right Way to Transfer Files Via SSH? (2024)

  • By Elvis Plesky
  • March 12, 2024
  • Various

3

Minutes

Looking to migrate a website from one server to another? You’ve got options. One popular method involves downloading the entire site to your computer and then uploading it to the new server. Or you could use third-party FTP tools to access both servers and move files between them. But there’s a more efficient and secure approach you might not have considered: transferring files over Secure Shell (SSH). Let’s explore how this method works and why it might be the ideal solution for your migration needs.

What is SSH?

SSH is a secure network protocol that allows you to utilize network services securely by creating a safe channel on an unsecured network. But it operates through the command line, as opposed to the majority of third-party FTP applications. You can choose either the Windows Command Prompt or Terminal in Mac and Linux systems to use SSH.

Does your version of Windows predate Windows 10? A third-party app is necessary to take advantage of SSH, as it only became native with that version. In cases like these, Putty is the most widely used SSH app for Windows. You can find it at https://www.putty.org/.

SSH is a native feature in Mac and Linux systems, though, so you can use it straight out of the box. And as most servers run on Linux, SSH should be available natively — unless your server is on Internet Information Service (IIS), the Windows equivalent.

As a result, you won’t need to install third-party apps (except Putty) to follow the below guide.

What is Secure Copy Protocol (SCP)?

Sending files over SSH relies on the SCP protocol: this is a technique for transferring files and folders from computer to computer securely. It’s based on the SSH protocol used with it.

A client can use an SCP to upload files to a remote server safely, download files, or even transfer files via SSH across remote servers. We’ll focus on this below.

Transferring Files Via SSH Across Remote Servers: a 3-Step Process

Let’s find out how to use your Windows computer to connect to a remote Mac or Linux server.

Step One: Checking and Enabling SSH on Remote Servers

Use your remote servers’ web console to log in. Access their control panels and check that SSH is enabled. Follow these steps:

  1. SSH tends to be disabled initially as standard, so you might need to enable it. If you don’t know how to do that, look at the documentation for your server OS or contact the provider’s support service.
  2. Make a note of the SSH username assigned: this will either be created by you or the server, depending on the server’s operating system.
  3. Enter the password twice (to confirm) to finish creating your SSH account — you can change the password, but servers have their own methods for doing so.
  4. Make a note of the Secure Shell Connection Information — you’ll need this to connect to the remote server when you utilize the SSH client.
  5. Note your servers’ host key (for security purposes).

Step Two:Setting Up SSH Remote Server Connection with PuTTY

Transferring files via SSH across remote servers is made simple with PuTTY, a versatile Windows application renowned for its secure connection capabilities and seamless file transfer functionalities. For this process, you´ll need to start by installing PuTTY

Start PuTTY and set up your SSH remote server connection.

  1. In the Configuration window, input the required details into the Host Name field.
  2. Make the connection.
  3. PuTTY will show you a security warning if this is the first time you’re connecting to a server. But if it’s NOT the first time and you still receive the alert, be careful. It might be that a hacker has targeted you with a Man-In-The-Middle attack, trying to occupy your connection and take your password.
  4. Feel satisfied that it’s an authentic connection? Click the Yes button. PuTTY will display a terminal window, and prompt you to enter your username followed by your password. Input your information. There’s no on-screen response when you enter passwords over SSH. Just put your password in and tap the Enter button!
  5. When you enter your password correctly, the terminal window presents a command line on the server. You can enter commands into this terminal window, and enjoy limited server control. All server responses are visible in this window.

Step Three:Transferring Files Between Remote Servers Using Secure Copy (SCP):

  1. Find the destination folder you’re looking for on the remote server (through PuTTY).
  2. Check the folder’s contents to make sure none of its files or folders have been given an identical name to the files or folders you intend to transfer. If they have been, try to rename or delete them, or relocate them to a different folder.
  3. With Secure Copy, transfer files from server to server. Here’s the Secure Copy syntax (“scp” enables the function): scp [switch] [source content location] [destination content location]
  4. “Switch” is optional. If you want to transfer a file over SSH (one only), or several stored in a directory and intended to share the same folder, you WON’T require a switch. But you WILL need one if you plan to transfer whole folders, and that is the “recursive switch” (-r).
  5. -r is not the only switch available — you can use many others to control SCP (but we won’t go into them in this guide).
  6. The Content Location syntax differs based on its location. For content found on the server you’re logged into, the location is the directory or filename you want to use. For example, “/var/www/dir”. But for content stored on the second remote server that you’re not logged into, things get a little more complex. For example,

[userid]@[remote server 2 url or ip address]:[directory or file] — [emailprotected]:/var/www/

So, a complete example of the syntax you need for transferring a directory from remote server to remote server would look like this (if the destination is the server you’re logged into at present):

scp - r [emailprotected]:/var/www/var/www/dir

You’ll be asked to put your password in for the second remote server. You won’t see it appear as you enter your password, as before. When you’re done, hit Enter.

You’ll see the file transference process begin if you have entered the right password for the second remote server. Now, you can shut the terminal window: the transfer will carry on automatically!

Conclusion

Utilizing Secure Shell (SSH) for file transfers offers a combination of security and efficiency that is hard to beat. With SSH you can streamline your workflow and ensure the integrity of your data during transfers. Additionally, understanding the role of SSH keys in authentication adds an extra layer of security to your server operations. For a comprehensive guide on SSH keys and how to use them effectively, check out our article “SSH Keys: A Guide for Beginners.” With the right tools and knowledge at your disposal, you should find sending files over SSH easier.

0 Shares

What's the Right Way to Transfer Files Via SSH? (1)

Elvis Plesky

Our fun and curious team mascot's always plugged into the latest trends.He's here to share his knowledge and help you solve your tech problems.

4 Comments

  1. What's the Right Way to Transfer Files Via SSH? (2)

    Philip

    Nov 25, 2021 / 7:01 am # Link Reply

    May I know if you guys will actually recommend the SCP command or the RSYNC command in this case?

    • What's the Right Way to Transfer Files Via SSH? (3)

      Louis Vanfraechem

      Dec 21, 2021 / 12:04 pm # Link Reply

      Hi there,
      In this case, we do not have a specific recommendation as both commands should be suitable going forward.

  2. What's the Right Way to Transfer Files Via SSH? (4)

    laura

    Dec 24, 2021 / 1:04 pm # Link Reply

    Hi
    Excusme, Can you send me pictuer how transfer file.jar to the server.
    thank you.

    • What's the Right Way to Transfer Files Via SSH? (5)

      Louis Vanfraechem

      Dec 28, 2021 / 9:47 am # Link Reply

      Hi Laura,
      To address your request, you are more than welcome to reach out to our https://support.plesk.com as they will be able to assist you further.

Add a Comment

More results...

GET LATEST NEWS AND TIPS

Related Posts

SSH Keys: A Guide for Beginners

Read More »

Obsidian Release Delivers Mail and SSH Updates

Read More »

Software Tools to Prevent Attacks on Servers and Sites

Read More »

Knowledge Base

Ports Used by Plesk

Read More »

WP Toolkit – Access WP-CLI

Read More »

FTP connection is randomly dropped during file transfer on Plesk for Linux server with SELinux

Read More »

SFTP is not available for additional FTP users on Plesk server

Read More »

SSH Terminal

Read More »

Plesk Obsidian 18 + Docker + Gitlab – SSL and SSH issues

Read More »

What's the Right Way to Transfer Files Via SSH? (2024)
Top Articles
Lost Ark Leveling Guide - How to Get to Level 50 Fast
DeltaNet is now VinciWorks | VinciWorks
Frank Lloyd Wright, born 150 years ago, still fascinates
How To Be A Reseller: Heather Hooks Is Hooked On Pickin’ - Seeking Connection: Life Is Like A Crossword Puzzle
Beautiful Scrap Wood Paper Towel Holder
Pitt Authorized User
The Best English Movie Theaters In Germany [Ultimate Guide]
AB Solutions Portal | Login
Zachary Zulock Linkedin
Moe Gangat Age
Items/Tm/Hm cheats for Pokemon FireRed on GBA
Edible Arrangements Keller
Johnston v. State, 2023 MT 20
Viha Email Login
Steamy Afternoon With Handsome Fernando
Conscious Cloud Dispensary Photos
What is Rumba and How to Dance the Rumba Basic — Duet Dance Studio Chicago | Ballroom Dance in Chicago
Andhrajyothy Sunday Magazine
Vintage Stock Edmond Ok
Van Buren County Arrests.org
Rural King Credit Card Minimum Credit Score
Soulstone Survivors Igg
Caring Hearts For Canines Aberdeen Nc
University Of Michigan Paging System
Avatar: The Way Of Water Showtimes Near Maya Pittsburg Cinemas
Student Portal Stvt
Firefly Festival Logan Iowa
Tottenham Blog Aggregator
Bend Missed Connections
Duke University Transcript Request
Publix Coral Way And 147
Storelink Afs
Pnc Bank Routing Number Cincinnati
Mgm Virtual Roster Login
Wow Quest Encroaching Heat
Today's Final Jeopardy Clue
Kvoa Tv Schedule
Marie Peppers Chronic Care Management
Personalised Handmade 50th, 60th, 70th, 80th Birthday Card, Sister, Mum, Friend | eBay
Edict Of Force Poe
20 Best Things to Do in Thousand Oaks, CA - Travel Lens
Troy Gamefarm Prices
Woodman's Carpentersville Gas Price
Adam Bartley Net Worth
Uvalde Topic
Nba Props Covers
Actor and beloved baritone James Earl Jones dies at 93
Sams Gas Price Sanford Fl
Blippi Park Carlsbad
Denys Davydov - Wikitia
Latest Posts
Article information

Author: Gov. Deandrea McKenzie

Last Updated:

Views: 6456

Rating: 4.6 / 5 (66 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Gov. Deandrea McKenzie

Birthday: 2001-01-17

Address: Suite 769 2454 Marsha Coves, Debbieton, MS 95002

Phone: +813077629322

Job: Real-Estate Executive

Hobby: Archery, Metal detecting, Kitesurfing, Genealogy, Kitesurfing, Calligraphy, Roller skating

Introduction: My name is Gov. Deandrea McKenzie, I am a spotless, clean, glamorous, sparkling, adventurous, nice, brainy person who loves writing and wants to share my knowledge and understanding with you.