linux-scp command and how to set up free log in secret

Often between two servers copy files, how to set up free log in dense deployment of test environments?

Scene: A source server (such as 172) -> the destination server B (such as 71) to realize the copy file server A to the server B

There are two ways:

Execution on the source server A (172): If the service has been set free during two secret login, you only need to execute the following command red

[yyuser@hlyy home]$ cd ~/.ssh
[yyuser@hlyy .ssh]$ ll
total 16
-rw-r--r-- 1 yyuser yyuser  793 Jul 24 16:00 authorized_keys
-rw------- 1 yyuser yyuser 1679 Mar  1  2019 id_rsa
-rw-r--r-- 1 yyuser yyuser  393 Mar  1  2019 id_rsa.pub
-rw-r--r-- 1 yyuser yyuser 1932 Aug 21 18:21 known_hosts
[yyuser@hlyy .ssh]$ ssh-copy-id chenjl@10.1.1.71
/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/yyuser/.ssh/id_rsa.pub"
/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
chenjl@10.1.1.71's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh '[email protected]'"
and check to make sure that only the key(s) you wanted were added.

[yyuser@hlyy home]$ ll
total 4
-rw-r--r--  1 root   root      0 Sep  2 23:59 a.txt
drwx------ 10 yyuser yyuser 4096 Sep  2 17:22 yyuser
[yyuser@hlyy home]$ scp -r a.txt [email protected]:/home/py
a.txt                                                                                                                                 100%    0     0.0KB/s   00:00  

Executed on the target server B (71): If the service has been set free during two secret login, you only need to execute the following command red

[chenjl@ipha-dev71-1 py]$ cd ~/.ssh/
[chenjl@ipha-dev71-1 .ssh]$ ll
total 20
-rw------- 1 chenjl users 5215 Sep  2 23:49 authorized_keys
-rw------- 1 chenjl users 1679 Dec  4  2018 id_rsa
-rw-r--r-- 1 chenjl users  401 Dec  4  2018 id_rsa.pub
-rw-r--r-- 1 chenjl users 1226 Sep  2 23:36 known_hosts
[chenjl@ipha-dev71-1 .ssh]$ ssh-copy-id yyuser@10.1.1.172
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/chenjl/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
yyuser@10.1.1.172's password: 
/home/yyuser/osinfo.sh: line 17: lspci: command not found

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh '[email protected]'"
and check to make sure that only the key(s) you wanted were added.

[chenjl@ipha-dev71-1 .ssh]$ scp [email protected]:/home/a.txt /home/py
/home/yyuser/osinfo.sh: line 17: lspci: command not found
a.txt

Guess you like

Origin www.cnblogs.com/wang-mengmeng/p/11450620.html