Due to the need to remotely transfer the file a server to the B server but the SCP command to manually enter the password each time so that the script execution is too cumbersome, so that a server and B server Trust can be, the specific operation is as follows:
First in a server configuration: mkdir-p ~/.ssh chmod ~/.ssh then generate the key file in the ~/.SSH directory: cd ~/.shh ssh-keygen-t rsa-p ""-F ~/.ssh /id_rsa then configure on the B server: mkdir-p ~/.ssh Touch ~/.ssh/authorized_keys appends the id_rsa.pub content of the a server to the authorized_ of server B Keys inside ssh 192.168.1.1 (a server's IP address does not need an add-on port number) cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys chmod ~/.ssh/authorized_keys last executed scp-r demotest b server IP address:/ Can
Automatic password entry using SCP remote transfer under Linux