LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Cannot copy directories by SCP on CentOs 8 (https://www.linuxquestions.org/questions/linux-newbie-8/cannot-copy-directories-by-scp-on-centos-8-a-4175668777/)

tcpuniverse 01-31-2020 05:32 PM

Cannot copy directories by SCP on CentOs 8
 
Hi;
I installed Solarwinds Toolset on my Windows 10 PC and wanted to copy files and folders to and from my Centos 8 test PC between them. While copying files to and from the SCP server worked fine, I didn't managed to copy directories with -r option:

scp -r cisco@10.100.1.10:/TDocs/ Downloads/
scp: Failed to open file /TDocs/


I have a folder named TDocs in the c:/SFTP_Root folder on my windows PC which is the root folder for SCP/SFTP and there are many files inside it. As seen, TDocs is actually a folder and I did copied individual files via SCP without any issue. I checked the permission of the Solarwinds SCP software on my PC; It had all of the create/read/write/delete permissions enabled.

berndbausch 01-31-2020 05:39 PM

I don't know how your Windows SSH server works, but I would try removing the leading slash in /TDocs. Or the trailing one.

tcpuniverse 01-31-2020 05:53 PM

Quote:

Originally Posted by berndbausch (Post 6084997)
I don't know how your Windows SSH server works, but I would try removing the leading slash in /TDocs. Or the trailing one.

I did it, but got the same error message.

Code:

[tay@tcentos ~]$ scp -r cisco@10.100.1.10:TDocs/ Downloads/       
cisco@10.134.15.119's password:
scp: Failed to open file TDocs/.

[tay@tcentos ~]$ scp -r cisco@10.100.1.10:/TDocs Downloads/
cisco@10.134.15.119's password:
scp: Failed to open file /TDocs.


michaelk 01-31-2020 09:21 PM

I am also unfamiliar with Solarwinds SFTP server. It looks more like a server problem then a client problem since the syntax appears correct when connecting to a linux sftp server. Maybe using a wild card will work.

Code:

scp -r cisco@10.100.1.10:/TDocs/* Downloads/
Although I have played with filezilla sftp server on Windows I prefer it being the client then the server. There are GUI tools i.e WinSCP and filezilla and PuTTy has windows command line tools for sftp and scp that are very similar to the linux commands.

scasey 01-31-2020 09:26 PM

I agree with michaelk...rather than try to run ssh on the Windows 10 box, just use WinSCP to transfer files to and from the Linux box...

Turbocapitalist 01-31-2020 10:27 PM

Ditto. This problem will be solved by running OpenSSH-server on the CentOS box and using the legacy system only as the client. PuTTY and WinSCP are two good examples that will work then.

tcpuniverse 02-01-2020 12:24 PM

Thanks for the replies. I'm learning basic Linux so I wanted only to know why command didn't work. If the syntax was right, then I think the SCP software might have something needed to be checked or fixed.

Turbocapitalist 02-01-2020 12:38 PM

scp and sftp are different programs and use unrelated protocols. scp is inspired by long defunct rcp and it does more less what rcp did but with encryption bolted on. In other words it is brittle and not clearly defined. It requires working (maybe identical) copies of scp itself on both ends of the connection. So if you're into testing, try putting OpenSSH-server on the CentOS machine going the other direction using the Solarwinds scp utility to connect it.

In contrast to scp, the SFTP client uses a much newer and well-defined protocol instead, and should be more independent from implementation. So you might try with the SFTP client instead. There is a batch mode for the SFTP client.

michaelk 02-01-2020 02:17 PM

Quote:

If the syntax was right, then I think the SCP software might have something needed to be checked or fixed.
A quick search did not find much information/documentation other then a few basic configuration items and starting the server. There might be more documentation provided with the actual program but I am not going to download it. Other then asking Solarwinds since it appears to be a server problem there is nothing that can be fixed on the linux side.


All times are GMT -5. The time now is 12:59 PM.