This website collects cookies to deliver better user experience, you agree to the Privacy Policy.
Accept
Sign In
The Texas Reporter
  • Home
  • Trending
  • Texas
  • World
  • Politics
  • Opinion
  • Business
    • Business
    • Economy
    • Real Estate
  • Crypto & NFTs
  • Tech
  • Lifestyle
    • Lifestyle
    • Food
    • Travel
    • Fashion
    • Books
    • Arts
  • Health
  • Sports
  • Entertainment
Reading: How To Use SCP (Safe Copy) With SSH Key Authentication
Share
The Texas ReporterThe Texas Reporter
Font ResizerAa
Search
  • Home
  • Trending
  • Texas
  • World
  • Politics
  • Opinion
  • Business
    • Business
    • Economy
    • Real Estate
  • Crypto & NFTs
  • Tech
  • Lifestyle
    • Lifestyle
    • Food
    • Travel
    • Fashion
    • Books
    • Arts
  • Health
  • Sports
  • Entertainment
Have an existing account? Sign In
Follow US
© The Texas Reporter. All Rights Reserved.
World

How To Use SCP (Safe Copy) With SSH Key Authentication

Editorial Board
Editorial Board Published January 5, 2025
Share
How To Use SCP (Safe Copy) With SSH Key Authentication
SHARE

Anybody who administers Linux machines seemingly is aware of safe shell. With out this software, administering these servers remotely could be fairly difficult. It could additionally develop into more durable to maneuver information forwards and backwards, no less than with a modicum of safety. That’s the place safe copy comes into play. With the SCP command, you possibly can copy information to and from a distant Linux server by an encrypted SSH tunnel.

SEE: How you can View Your SSH Keys in Linux, macOS, and Home windows

Nonetheless, with the assistance of SSH key authentication, you can also make that much more safe. I wish to present you ways you should use safe key authentication and SCP so you possibly can relaxation assured your information are being moved forwards and backwards securely. I’ll reveal on an Elementary OS shopper and Ubuntu 16.04.1 server and assume you will have a safe shell put in and dealing.

1
New Relic

Workers per Firm Measurement

Micro (0-49), Small (50-249), Medium (250-999), Giant (1,000-4,999), Enterprise (5,000+)

Any Firm Measurement
Any Firm Measurement

Options

Analytics / Reviews, API, Compliance Administration, and extra

2
Rippling IT

Workers per Firm Measurement

Micro (0-49), Small (50-249), Medium (250-999), Giant (1,000-4,999), Enterprise (5,000+)

Any Firm Measurement
Any Firm Measurement

Options

Exercise Monitoring, Automated Provisioning, Configuration Administration, and extra

3
Zoho Help

Workers per Firm Measurement

Micro (0-49), Small (50-249), Medium (250-999), Giant (1,000-4,999), Enterprise (5,000+)

Any Firm Measurement
Any Firm Measurement

Options

Analytics / Reviews, API, Doc Administration / Sharing, and extra

SSH keys

The very first thing that should be completed is to create an SSH key pair. To do that, open up a terminal window and problem the command:

ssh-keygen -t rsa

You can be requested to call the file (use the default) and provides the keypair a passphrase.

How To Use SCP (Safe Copy) With SSH Key Authentication

As soon as the important thing’s randomart prints, your key is able to go.

The subsequent step is to repeat the important thing to the distant server. That is completed with the command:

ssh-copy-id USER@SERVER

The place USER is the username of the distant server, and SERVER is the tackle of the distant server.

You can be prompted for the distant consumer password. When you efficiently authenticate, the general public key will probably be copied to the server. You’re able to go.

SEE: Securing Linux coverage (Tech Professional Analysis)

Utilizing SCP along with your key

Now that our keys are in all the fitting locations, let’s see how we are able to use them by SCP. Assuming you accepted the default identify in your SSH key upon creation, the command to ship a file to your distant server utilizing your SSH secret’s:

scp -i ~/.ssh/id_rsa.pub FILENAME USER@SERVER:/house/USER/FILENAME

The place FILENAME is the identify of the file, USER is the username on the distant machine, and SERVER is the tackle of the distant server.

Try to be prompted for the SSH key password (not the consumer password). As soon as authenticated, the file will probably be transferred.

The identical holds true if it is advisable pull a file from the distant server. The construction of that command could be:

scp -i ~/.ssh/id_rsa.pub USER@SERVER:/house/USER/FILENAME /house/USER/FILENAME

Once more, you may be requested in your SSH key password, and the file will probably be pulled from the server and copied to the native machine.

SEE: How you can Add an SSH Fingerprint to Your known_hosts File in Linux

Neglect that password

Let’s say you’re about to endure an extended session of copying information to your server. Positive, you may tar all of them up into one larger file. However say they should all be positioned in numerous directories. That’s lots of typing. You may make this barely extra environment friendly by utilizing the ssh-agent and ssh-add instructions.

That’s proper, utilizing the mixture of SCP, SSH key authentication, and ssh-agent works properly. This may maintain you from having to kind that SSH key password each time you problem the SCP command. The one caveat is that you need to bear in mind the PID of the agent session and kill it whenever you’re completed.

Right here’s what it’s important to do.

  1. Earlier than issuing the SCP command problem eval ssh-agent to begin the session.
  2. Make an observation of the Course of ID you’re given when the session begins.
  3. Add your SSH key to the session with the command ssh-add.
  4. Begin utilizing SCP to repeat your information.

That’s all there may be to it. Once you’re completed with the session, guarantee to problem the command kill PID (the place PID is the precise quantity given to you whenever you began the ssh-agent session with eval).

SEE: 20 fast tricks to make Linux networking simpler (free PDF) (TechRepublic)

Is SCP nonetheless safe?

Somebody asking if SCP is safe has seemingly learn the 2019 launch announcement for OpenSSH 8.0, which said that the SCP protocol is “outdated, inflexible and not readily fixed” and beneficial SFTP and Rsync as alternate options for file switch.

Earlier than OpenSSH 8.0, SCP couldn’t confirm file integrity throughout transfers, leaving customers uncovered to unauthorized overwrites and injection assaults if their server was compromised (CVE-2019-611). Nonetheless, the replace launched stricter filename checking because the default for the SCP command, making it safer, and moved its earlier non-checking habits to the command scp -T.

Then, in OpenSSH 9.0, launched in 2022, SFTP was adopted because the default backend for SCP as an alternative of the legacy SCP/RCP protocol, that means that transfers are actually encrypted and authenticated with the SSH protocol. Whereas extensively considered safe, customers ought to nonetheless be cautious of different dangers like misconfigured servers or outdated software program variations.

What can I exploit as an alternative of SCP?

  • SFTP: Whereas SCP defaults to utilizing the SFTP protocol, you possibly can think about using native SFTP purchasers for superior file administration because it permits for extra operations, corresponding to viewing directories and file deletion.
  • Rsync: Supreme for synchronizing information and directories, particularly for incremental backups and huge datasets. See TechRepublic’s information on find out how to again up a community utilizing Rsync.
  • FTPS: A safe choice for conventional FTP transfers with SSL/TLS encryption, however it may be advanced to configure.
  • HTTPS-based instruments: Equivalent to curl or wget, for safe downloads over HTTPS. That is nice for automation, however they don’t present full listing administration like SFTP.

Fiona Jackson up to date this text in January 2025.

TAGGED:AuthenticationCopykeySCPSecureSSH
Share This Article
Twitter Email Copy Link Print
Previous Article AlphaTheta’s DDJ-FLX2 Is a Close to Good Controller for New DJs AlphaTheta’s DDJ-FLX2 Is a Close to Good Controller for New DJs
Next Article Kody Brown Proposes to Robyn: Will You Be My (Solely) Spouse? Kody Brown Proposes to Robyn: Will You Be My (Solely) Spouse?

Editor's Pick

Sizzling Lady Summer time Begins within the Bathe—Right here’s Learn how to Prep Your Pores and skin

Sizzling Lady Summer time Begins within the Bathe—Right here’s Learn how to Prep Your Pores and skin

We might obtain a portion of gross sales if you buy a product by a hyperlink on this article. Most…

By Editorial Board 8 Min Read
Alpine’s Sizzling Hatch EV Has a Constructed-In, ‘Gran Turismo’ Model Driving Teacher

One other win over its Renault 5 sibling is a multi-link rear…

3 Min Read
Louis Vuitton Is Dropping a New Perfume As a result of It’s Sizzling | FashionBeans

We independently consider all beneficial services and products. Any services or products…

2 Min Read

Latest

“A Family’s Fight to Reclaim Their Legacy”

“A Family’s Fight to Reclaim Their Legacy”

Introduction: For generations, the Wright family has worked and lived…

July 9, 2025

AR Global Inc CEO Kason Roberts Donates to Support Kerrville Storm Victims, Mobilizes Team for Restoration Efforts

Kerrville, Texas — In the aftermath…

July 9, 2025

Bitcoin Tops $109,000 After Senate Passes Trump’s ‘Big Beautiful Bill’ – “The Defiant”

The crypto market posted modest good…

July 9, 2025

Two vital hazard alerts within the June employment report – Indignant Bear

Two vital hazard alerts within the…

July 9, 2025

Simone Biles Thirst Traps in Bikini Amidst Boob Job Hypothesis

Studying Time: 3 minutes Simone Biles…

July 9, 2025

You Might Also Like

Part of Pulwama IED was ordered through Amazon: FATF | India Information
World

Part of Pulwama IED was ordered through Amazon: FATF | India Information

NEW DELHI: International terror financing watchdog Monetary Motion Process Power (FATF) has raised issues concerning the exploitation of e-commerce platforms…

3 Min Read
Dementia hope as new weight-reduction plan linked to 53% drop in Alzheimer’s danger
World

Dementia hope as new weight-reduction plan linked to 53% drop in Alzheimer’s danger

A dietary strategy combining components of the Mediterranean and Sprint consuming patterns may cut back the danger of growing Alzheimer’s…

3 Min Read
10 arrested at drug cartel “ranch of horror” discovered responsible of homicide in Mexico
World

10 arrested at drug cartel “ranch of horror” discovered responsible of homicide in Mexico

Ten males arrested at a farm linked to a drug cartel within the Mexican state of Jalisco had been discovered responsible…

5 Min Read
‘Manasi’ initiative launched to assist psychosocial rehabilitation of girls in shelter residence
World

‘Manasi’ initiative launched to assist psychosocial rehabilitation of girls in shelter residence

Left to Proper – Fr. R Jesudas, Govt Director, Caritas India, Ms Zoraida Samuel, Managing Trustee, Rehoboth Public Charitable Belief,…

1 Min Read
The Texas Reporter

About Us

Welcome to The Texas Reporter, a newspaper based in Houston, Texas that covers a wide range of topics for our readers. At The Texas Reporter, we are dedicated to providing our readers with the latest news and information from around the world, with a focus on issues that are important to the people of Texas.

Company

  • About Us
  • Newsroom Policies & Standards
  • Diversity & Inclusion
  • Careers
  • Media & Community Relations
  • WP Creative Group
  • Accessibility Statement

Contact Us

  • Contact Us
  • Contact Customer Care
  • Advertise
  • Licensing & Syndication
  • Request a Correction
  • Contact the Newsroom
  • Send a News Tip
  • Report a Vulnerability

Term of Use

  • Digital Products Terms of Sale
  • Terms of Service
  • Privacy Policy
  • Cookie Settings
  • Submissions & Discussion Policy
  • RSS Terms of Service
  • Ad Choices

© The Texas Reporter. All Rights Reserved.

Welcome Back!

Sign in to your account

Lost your password?