Facebook X (Twitter) Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook X (Twitter) Instagram
    TecAdmin
    You are at:Home»Linux Tutorials»How to Download and Upload Files over SSH

    How to Download and Upload Files over SSH

    By RahulJuly 24, 20212 Mins Read

    SSH is the most secure protocol for accessing remote servers. It provides the highest level of end-to-end data security over communication channels. The SCP (Secure Copy) command uses the SSH protocol for copying files between remote and local servers.

    The remote server must have a running SSH server. This tutorial will help you to understand download and upload files over SSH protocol.

    Download file over SSH Protocol

    Here are some useful examples for downloading files from the remote system over SSH protocol.

    • This will connect to example.com server with user “username” and copy the /backup/file.zip file to local system directory /local/dir. To use theis command replace the values as per your environment.
      scp [email protected]:/backup/file.zip /local/dir 
      
    • If the SSH is running on a non-standard port, You can specify the port using -P option with SCP command.
      scp -P 2222 [email protected]:/backup/file.zip /local/dir 
      
    • If your remote server required a private key to connect server, You can use -i followed by a private key file path to connect your server using the SCP command. This can be helpful for AWS servers.
      scp -i private_key.pem [email protected]:/backup/file.zip /local/dir 
      

    Upload file using SSH

    You can also upload files to the remote server using SSH protocol using the SCP command. Use the following example command for uploading files to the SSH server.

    scp file.zip [email protected]:/remote/dir 
    

    Similarity you can use -P switch to define port of the SSH server and -i to define private key for the user authentication.

    Conclusion

    In this tutorial, you have learned about transferring files between two systems over the SSH protocol.

    scp SSH
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    How to Avoid the SSH Broken Pipe Error

    Understanding the LD_LIBRARY_PATH Environment Variable

    The Beginner’s Guide to Building Your First RPM Package

    View 4 Comments

    4 Comments

    1. iamleada on May 15, 2021 6:21 pm

      best explanation on the whole internet

      Reply
    2. Oliver on October 22, 2020 10:08 pm

      This is after sshing into the server?

      Reply
    3. vinod on September 16, 2020 3:29 pm

      download for ssh open

      Reply
    4. Sergio Trett on September 7, 2020 1:18 pm

      So simple! Thanks Rahul. (Actually, I’ve tried download only, but…)

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Using .env Files in Django
    • Using .env File in FastAPI
    • Setting Up Email Notifications for Django Error Reporting
    • How to Enable Apache Rewrite (mod_rewrite) Module
    • What are Microservices?
    Facebook X (Twitter) Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.