Changes

Remote File Copy from the Linux Command Prompt

2,273 bytes added, 22:06, 24 July 2020
/* SCP - Secure Copy Protocol */
The following lines were added (+) and removed (-):
=== 1. SCP - Secure Copy Protocol ====== SCP - Secure Copy Protocol ===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]] === Insecure File Copy === ie: Netcat File Copy.  It's not really called Insecure File Copy, but to make a point, only use this method on your private LAN for files where security does not matter.  This is the quick and dirty way to move a file even if ssh is not installed.  Although netcat has many functions, you can copy a file from one machine to another using Netcat.   You basically issue the netcat command on the receive computer assigning a port with a redirect to file output.  It will sit and listen for a connection then terminate when complete.  Type this on the receive computer:  nc -l 2222 > myfile.pdfThen on the source machine which is at IP address 192.168.50.1 in our example where the file exists you type the following:  nc 192.168.50.1 2222 < myfile.pdf 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.=== 2. RZSZ - XMODEM, YMODEM, ZMODEM file transfer ====== RZSZ - XMODEM, YMODEM, ZMODEM file transfer ====== 3. ZSSH - File transfer using Secure Shell and RZSZ ====== ZSSH - File transfer using Secure Shell and RZSZ ====== 4. RCP - remote file copy ====== RCP - remote file copy ===
Bureaucrat, administrator
16,192
edits