

The examples above feature several SCP options that modify the command. However, if you want to reroute the operation through your machine, add the -3 option as shown in the following command: scp -3 Using the SCP Command With Options Under normal circumstances, the file will go straight from the first remote server to the second. To copy folders, use the -r option and specify the folder path instead of the file inside it. To copy files from one remote server to another, you will have to enter the passwords for both accounts after running the following command in your terminal: scp command above copies the source file /writing/article/scp.zip from the first host to the second one. Safely Moving a File Between Remote Hosts It won’t appear only if sudo privileges have disabled authentication or forced the SSH client to use a private key on your machine. scp Users/Hostinger/DesktopĮxecuting this command will prompt the same SSH login output requiring a password. This time, we will copy the scp.zip file from the same remote host to our local computer. Reversing the source and target systems of the command must be reflected in the syntax. Transferring a Remote File to a Local Machine To find a directory’s full path, navigate to the appropriate directory and use the pwd SSH command (print working directory). The following example shows the SCP command in a real-world scenario: scp -p you’re copying to or from a local host, you won’t need the IP address and the destination or source path like /desktop/folder_name.

:/ ‒ informs the SCP command that the user will type in the source directory.

