LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-31-2020, 05:32 PM   #1
tcpuniverse
LQ Newbie
 
Registered: Dec 2017
Posts: 4

Rep: Reputation: Disabled
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.
 
Old 01-31-2020, 05:39 PM   #2
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
I don't know how your Windows SSH server works, but I would try removing the leading slash in /TDocs. Or the trailing one.
 
Old 01-31-2020, 05:53 PM   #3
tcpuniverse
LQ Newbie
 
Registered: Dec 2017
Posts: 4

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by berndbausch View Post
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.
 
Old 01-31-2020, 09:21 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,710

Rep: Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899
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.
 
1 members found this post helpful.
Old 01-31-2020, 09:26 PM   #5
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,727

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
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...
 
Old 01-31-2020, 10:27 PM   #6
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,311
Blog Entries: 3

Rep: Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722
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.
 
Old 02-01-2020, 12:24 PM   #7
tcpuniverse
LQ Newbie
 
Registered: Dec 2017
Posts: 4

Original Poster
Rep: Reputation: Disabled
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.
 
Old 02-01-2020, 12:38 PM   #8
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,311
Blog Entries: 3

Rep: Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722Reputation: 3722
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.
 
1 members found this post helpful.
Old 02-01-2020, 02:17 PM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,710

Rep: Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899Reputation: 5899
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.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy or scp specific files in sub directories maintaining same tree structure...??? Drigo Linux - Newbie 3 09-26-2012 11:09 AM
Centos 6.3 host+guest: try scp to guest: scp cmd not found. ssh ok chrism01 Linux - Virtualization and Cloud 3 08-24-2012 01:52 AM
[SOLVED] How to copy a folder with sub directories using scp sanjay87 Linux - Server 5 05-24-2012 06:40 AM
How do I copy over directories to directories with the same name without overwriting? SentralOrigin Linux - General 1 03-14-2009 01:09 AM
useing SCP to copy entire directories with sub folders? Lleb_KCir Linux - General 5 09-13-2005 09:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration