Changes

Remote File Copy from the Linux Command Prompt

1,374 bytes added, 22:06, 24 July 2020
/* SCP - Secure Copy Protocol */
The following lines were added (+) and removed (-):
Upload (syntax):Upload/PUSH (syntax):Upload (example):Upload/PUSH (example):Download (syntax):Download/PULL (syntax):Download (example):Download/PULL (example):   -v verbose mode                          -v verbose mode                      -P port Useful example: If you are using a remote server that you need to push files and directories to, and the remote server utilizes a nonstandard port, it might look like this (example): scp -P 2800 -r ./* nicolep@customerwebhosting.robotz.com:/home/nicolep/awesomesite.com THE TROUBLE WITH SPACES * scp: ambiguous target - error which often indicates white space has disrupted scp understanding the path.  If you have character 32 in a path, you have to escape the characters by using double backslashes \\ and enclosing the entire path in quotes: scp myfile.txt nicolep@192.168.1.1:"/file\\ path\\ with\\ spaces/secrets.txt"When uploading, the local source path does not require double quotes and double backslashes.  The local path will follow the same rules a bash shell path follows. scp ~/.local/share/Metagaming\ B.V./Angeldust/player_name* nicolep@192.168.0.3:"/home/nicolep/.local/share/Metagaming\\ B.V./Angeldust/"Why scp works this way is beyond me, I just hope the devs have a good reason for it. SCP For Macintosh OSX: Need to transfer files between linux and Mac OSX?*see: [[Secure Shell - Secure Copy Available on OSX]]You don't have to use port 2222, and you call the file whatever you want as long as the extensions are the same, and so on.   You don't have to use port 2222, and you call the file whatever you want as long as the extensions are the same, and so on. For multiple files you can use tar to put them all in a tarball then expand on the destination   tar zc *.* | nc -l 2222  nc 192.168.50.1 2222 | tar zx Remember that netcat simply reads data from stdin.
Bureaucrat, administrator
16,192
edits