Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Scp command syntax

2025-01-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

1. Copy the local file to the remote end

Scp file user @ hostname: remote directory scp 123.txt root@192.168.1.1:/

2. Copy the remote directory to the local

Scp-r user @ hostname: remote directory local directory scp-r root@192.168.1.2:/456.txt ~

3. SCP transfers files without entering a password

In the Linux environment, the scp command is usually used to transfer files between two hosts, and it is usually necessary to enter a password to confirm when using the scp command to obtain the other linux host files through ssh.

However, by establishing a trust relationship, it is possible not to enter a password.

1) execute the following command on one of the hosts to generate the pairing key:

Ssh-keygen-t rsa

Follow the prompts and be careful not to enter passphrase. The prompt message is as follows

Generating public/private rsa key pair.Enter file in which to save the key (/ root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again:Your identification has been saved in / root/.ssh/id_rsa.Your public key has been saved in / root/.ssh/id_rsa.pub.The key fingerprint is:63:61:d2:ce:5f:e8:14:5c:56:2c:7b:08:71:41:a2:cc root@localhost.localdomain

2.) copy the id_rsa.pub file in the .ssh directory to the ~ / .ssh/ directory on another host, and rename it authorized_keys.

Scp .ssh / id_rsa.pub hostname: / root/.ssh/authorized_keys

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report