SFTP not recognizing USB in one direction

Advertisement

TomAustin
Joined:
Posts:
7

SFTP not recognizing USB in one direction

I've enabled the SSH server in my Raspberry Pi. I'm using WinSCP to SFTP files to and from it. I'm testing it with a USB flash drive mounted at /mnt I've used chmod to set /mnt permissions at 777.

I can use a remote computer to access pi and copy files from /mnt to c:\testlocal. This works with WinSCP.

option batch on
option confirm off
open pi@mydomain.duckdns.org
option transfer binary
get /mnt* c:\testlocal\*
synchronize local c:\testlocal mnt
exit

But going the other way, it acts like it can't access /mnt. This doesn't work:

option batch on
option confirm off
open pi@mydomain.duckdns.org
option transfer binary
put c:\testlocal\* /mnt
synchronize remote c:\testlocal mnt
exit

If I use a folder such as /home/pi/testremote it does work, just not at /mnt.

Where is it going wrong? THANKS in advance for the help.

Here's the relevant log file info:

. 2017-05-27 18:57:19.906 Copying "c:\testlocal\matrix.jpg" to remote directory started.
. 2017-05-27 18:57:19.906 Binary transfer mode selected.
. 2017-05-27 18:57:19.906 Opening remote file.
> 2017-05-27 18:57:19.979 Type: SSH_FXP_OPEN, Size: 29, Number: 515
< 2017-05-27 18:57:19.981 Type: SSH_FXP_STATUS, Size: 24, Number: 515
< 2017-05-27 18:57:19.981 Status code: 4, Message: 515, Server: Failure, Language:
> 2017-05-27 18:57:19.982 Type: SSH_FXP_LSTAT, Size: 13, Number: 775
< 2017-05-27 18:57:19.984 Type: SSH_FXP_ATTRS, Size: 37, Number: 775
* 2017-05-27 18:57:19.984 (ETerminal) General failure (server should provide error description).
* 2017-05-27 18:57:19.984 Error code: 4
* 2017-05-27 18:57:19.984 Error message from server: Failure
* 2017-05-27 18:57:19.984
* 2017-05-27 18:57:19.984 Common reasons for the Error code 4 are:
* 2017-05-27 18:57:19.984 - Renaming a file to a name of already existing file.
* 2017-05-27 18:57:19.984 - Creating a directory that already exists.
* 2017-05-27 18:57:19.984 - Moving a remote file to a different filesystem (HDD).
* 2017-05-27 18:57:19.984 - Uploading a file to a full filesystem (HDD).
* 2017-05-27 18:57:19.984 - Exceeding a user disk quota.
. 2017-05-27 18:57:19.984 Asking user:
. 2017-05-27 18:57:19.984 Cannot overwrite remote file '/mnt'.$$
. 2017-05-27 18:57:19.984
. 2017-05-27 18:57:19.984 Press 'Delete' to delete the file and create new one instead of overwriting it.$$ ("General failure (server should provide error description).
. 2017-05-27 18:57:19.984 Error code: 4
. 2017-05-27 18:57:19.984 Error message from server: Failure
. 2017-05-27 18:57:19.984
. 2017-05-27 18:57:19.984 Common reasons for the Error code 4 are:
. 2017-05-27 18:57:19.984 - Renaming a file to a name of already existing file.
. 2017-05-27 18:57:19.984 - Creating a directory that already exists.
. 2017-05-27 18:57:19.984 - Moving a remote file to a different filesystem (HDD).
. 2017-05-27 18:57:19.984 - Uploading a file to a full filesystem (HDD).
. 2017-05-27 18:57:19.984 - Exceeding a user disk quota.")
< 2017-05-27 18:57:19.984 Script: Cannot overwrite remote file '/mnt'.
< 2017-05-27 18:57:19.984 Script: General failure (server should provide error description).
< 2017-05-27 18:57:19.984 Error code: 4
< 2017-05-27 18:57:19.984 Error message from server: Failure
< 2017-05-27 18:57:19.984 Common reasons for the Error code 4 are:
< 2017-05-27 18:57:19.984 - Renaming a file to a name of already existing file.
< 2017-05-27 18:57:19.985 - Creating a directory that already exists.
< 2017-05-27 18:57:19.985 - Moving a remote file to a different filesystem (HDD).
< 2017-05-27 18:57:19.985 - Uploading a file to a full filesystem (HDD).
< 2017-05-27 18:57:19.985 - Exceeding a user disk quota.
* 2017-05-27 18:57:19.986 (EScpSkipFile) Cannot overwrite remote file '/mnt'.$$
* 2017-05-27 18:57:19.986
* 2017-05-27 18:57:19.986 Press 'Delete' to delete the file and create new one instead of overwriting it.$$
* 2017-05-27 18:57:19.986 General failure (server should provide error description).
* 2017-05-27 18:57:19.986 Error code: 4
* 2017-05-27 18:57:19.986 Error message from server: Failure
* 2017-05-27 18:57:19.986
* 2017-05-27 18:57:19.986 Common reasons for the Error code 4 are:
* 2017-05-27 18:57:19.986 - Renaming a file to a name of already existing file.
* 2017-05-27 18:57:19.986 - Creating a directory that already exists.
* 2017-05-27 18:57:19.986 - Moving a remote file to a different filesystem (HDD).
* 2017-05-27 18:57:19.986 - Uploading a file to a full filesystem (HDD).
* 2017-05-27 18:57:19.986 - Exceeding a user disk quota.
. 2017-05-27 18:57:19.986 Script: Failed
> 2017-05-27 18:57:19.987 Script: synchronize remote c:\testlocal mnt
< 2017-05-27 18:57:19.987 Script: Comparing...
. 2017-05-27 18:57:19.987 Collecting synchronization list for local directory 'c:\testlocal' and remote directory 'mnt', mode = Remote, params = 0x2 (NoConfirmation), file mask = ''
. 2017-05-27 18:57:19.988 Local file 'c:\testlocal\.' [2017-05-27T04:34:32.788Z] [0] excluded from synchronization
. 2017-05-27 18:57:19.988 Local file 'c:\testlocal\..' [2017-05-27T04:34:32.788Z] [0] excluded from synchronization
. 2017-05-27 18:57:19.988 Local file 'c:\testlocal\matrix.jpg' [2014-06-27T03:36:55.000Z] [92031] included to synchronization
. 2017-05-27 18:57:19.988 Listing directory "/home/pi/mnt".
> 2017-05-27 18:57:19.988 Type: SSH_FXP_OPENDIR, Size: 21, Number: 1035
< 2017-05-27 18:57:19.991 Type: SSH_FXP_STATUS, Size: 29, Number: 1035
< 2017-05-27 18:57:19.991 Status code: 2, Message: 1035, Server: No such file, Language:
. 2017-05-27 18:57:19.991 Asking user:
. 2017-05-27 18:57:19.991 Error listing directory 'mnt'. ("No such file or directory.
. 2017-05-27 18:57:19.991 Error code: 2
. 2017-05-27 18:57:19.991 Error message from server: No such file")
< 2017-05-27 18:57:19.991 Script: Error listing directory 'mnt'.
< 2017-05-27 18:57:19.991 Script: No such file or directory.
< 2017-05-27 18:57:19.991 Error code: 2
< 2017-05-27 18:57:19.991 Error message from server: No such file
. 2017-05-27 18:57:19.992 Script: Failed
> 2017-05-27 18:57:19.992 Script: exit
. 2017-05-27 18:57:19.992 Script: Exit code: 1
. 2017-05-27 18:57:19.992 Closing connection.
. 2017-05-27 18:57:19.992 Sending special code: 12
. 2017-05-27 18:57:19.992 Sent EOF message


One clue why it may not work is in the log file , eighteen lines from the bottom.

2017-05-27 18:57:19.988 Listing directory "/home/pi/mnt".

It seems to think the USB drive is mounted at home/pi/mnt. But it's not. It's mounted at /mnt .

What needs to happen to make it look at /mnt and not /home/pi/mnt?

Reply with quote

Advertisement

Guest

Thanks. I got it working. I set up a raspberry pi server between my home computer and office computer. I want to copy each computer's latest files to the server and overwrite previous versions and then have each computer got to the server and copy the other computer's latest files from the server to itself. Here's the code that works, based on an article I read:

option batch on
option confirm off
open pi@mydomain.duckdns.org
option transfer binary
put //home/pi/testremote/office "C:\Users\ME\My Documents\2017"*
synchronize remote "C:\Users\ME\My Documents\2017" //home/pi/testremote/office
get /home/pi/testremote/homecomp* c:\homemydocs\*
synchronize local c:\homemydocs //home/pi/testremote/homecomp
exit

QUESTIONS:

Again, I adapted the code from an article I read. Why are the PUT and GET commands included here? I tried it with only the synchronize commands and it seems to work as well, in fact, much faster.

The PUT and GET commands take longer to execute than synchronize. I can see each file getting written. Is this because there is no file comparison being done as there is with the synchronize commands?

How does the synchronize command know to overwrite a previous version of the same file? Or does it?

THANKS!

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Anonymous wrote:

The PUT and GET commands take longer to execute than synchronize. I can see each file getting written. Is this because there is no file comparison being done as there is with the synchronize commands?
Yes.

How does the synchronize command know to overwrite a previous version of the same file? Or does it?
Synchronization is based (by default) on file timestamps.

Reply with quote

Advertisement

You can post new topics in this forum