LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 11-06-2015, 10:24 AM   #1
eulaersi
LQ Newbie
 
Registered: Jul 2007
Posts: 27

Rep: Reputation: 0
SFTP working but SCP not


I need to copy a directory with all its subdirectories to an SFTP server.

I can access the SFTP server by
Code:
sftp -oPort=#### USERNAME@IPADDRESS
But when I want to recursively copy all files, SFTP replies
Code:
put -r /local-dir/ /remote-dir/
put: Invalid flag -r
When looking on the internet, people advises to use SCP (I'm also more familiar with SCP). But this gives an error:
Code:
scp -P #### /local-dir/ USERNAME@IPADDRESS:/remote-dir/
Connection to IPADDRESS closed by remote host.
lost connection
Is this a server issue? I have no control over the server.

If it is, I'm obliged to use SFTP. But then I have the invalid flag -r issue. How can I solve this?

I'm using
Code:
$ ssh -v
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
Thanks for your help

-- Ivan
 
Old 11-06-2015, 11:17 AM   #2
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,636

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Quote:
Originally Posted by eulaersi View Post
I need to copy a directory with all its subdirectories to an SFTP server.
I can access the SFTP server by
Code:
sftp -oPort=#### USERNAME@IPADDRESS
But when I want to recursively copy all files, SFTP replies
Code:
put -r /local-dir/ /remote-dir/
put: Invalid flag -r
Because you're not calling sftp correctly. The -r doesn't go with the put, it goes when you spawn the sftp command, like "sftp -r user@host".
Quote:
When looking on the internet, people advises to use SCP (I'm also more familiar with SCP). But this gives an error:
Code:
scp -P #### /local-dir/ USERNAME@IPADDRESS:/remote-dir/
Connection to IPADDRESS closed by remote host.
lost connection
Is this a server issue? I have no control over the server. If it is, I'm obliged to use SFTP. But then I have the invalid flag -r issue. How can I solve this?
Since you have no control over the server, we can't tell how things are configured on that side of things...could very well be you don't have rights/permissions to access scp, but we can't guess.
 
Old 11-06-2015, 05:51 PM   #3
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
A few random considerations:

Are you sure the port is correct?
Can you log on with ssh?
Have you installed keys?
Does the server allow password authentication?
Use the -v -vv or -vvv options to get debug output.
If you have superuser privileges on the server, increase verbosity there.
 
Old 11-08-2015, 10:57 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Its possible the server is setup for sftponly eg http://www.serveradminforhire.com/sf...ut-bash-shell/.
Ask the SysAdmin.
 
  


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
sftp/scp without password chuikingman Linux - Server 9 08-21-2009 06:50 AM
Chroot SSH problem: ssh working, not SFTP & SCP. NaCo Linux - Security 3 02-01-2009 02:23 AM
scp vs. sftp Holyninja Linux - Newbie 1 10-29-2007 06:28 PM
scp vs. sftp . . . zthomasz Linux - Security 2 07-08-2003 08:26 AM
ssh working, but not sftp scp hardigunawan Linux - Networking 2 05-02-2003 02:04 AM

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

All times are GMT -5. The time now is 02:09 AM.

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