-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
io.Copy gives permission denied for get operation and io.ReadAll gives Bad Message for 190kb+ files #599
Comments
Hello @puellanivis , Can you please share some inputs around this? Customer is able to get the content of a file on SFTP server for their another test instance. It is just above described SFTP server that they run into issue, which seems to be their main SFTP server. Can you please suggest what could be the possible reason for this error and suggest alternate that I can try instead of io.Copy or io.ReadAll ? |
@aashakabra please avoid mentioning people directly. I understand the issue is urgent for you but you are using open source software for free, you can't expect help as if we were your colleagues working for the same company, we try to help when possible, but we also have our commitments, you opened this issue less than 12 hours ago. Thanks for understanding |
I understand. Sorry for the inconvenience. |
What options are you specifying in your |
I am not specifying any options.
I close the client connection in another call back method Stop which is called when engine is stopped. |
Can you try using |
Thankyou for your reply. Okay. Should I also add - sftp.UseFstat(true) along with sftp.UseConcurrentReads(false) ? As per above ping if this will further lead to SSH_X_BAD_MESSAGE - what can be probable solution for this? as on this specific SFTP server they are facing this error for file above 190kb. In past during development we faced size issue with io.ReadAll (no error but sftp get file content + sftp put file content -> the file size dint match. And then we decided to use io.Copy() instead which solved this issue for bigger file size. We never ran into error. It is this customer SFTP server where they are getting error further with 190kb+ file size - SSH_FX_BAD_MESSAGE |
I don’t know if the I’m not entirely sure why you’re getting It’s interesting that PS: Which version of this library are you using? |
I am using version github.com/pkg/sftp v1.13.6 Let me set the flag UseConcurrentReads(false) and give it a try on customer envt. |
This does not stop you from reading two different files concurrently. It stops the library from concurrently issuing read requests. It’s kind of a last ditch effort to provide the highest compatibility, but also the slowest speeds. |
We tried below two things on customer's envt-
Can you suggest if there is any permission we can give at customer's end so that stat function do not give error? |
Below are the SFTP server details that customer is connecting to --
|
The “file does not exist” errors are extremely weird, because there’s no zero reason why this should be the case. I would recommend that they double check, and triple check the filename. There’s pretty much no way that this library could work for files <190 kB, but “file does not exist” on the open… The As a wild shot, could you try the dev-v2 branch? It’s a pretty big rewrite, but the client API at least should be mostly the same. ( |
I’ve released a new version |
Hello , Let me work on sharing this with customer and test. Meanwhile, can you suggest what exact change is done in this version which is expected to work for above usecase? |
I don’t know of any specific change that could fix your problem… 🤷♀️ I don’t even know what is causing the problem in the first place. So, it’s a bit of darts in the dark. |
Hello,
I am doing a simple get operation on a file available on SFTP, but I am not writing the content in a file, I want to hold it in memory and want to pass it as output for futher transformation.
Below code works perfectly fine on our test SFTP server (openssh) but it fails with error on customer's SFTP server (which is very much older openssh and there are permission restrictions , I will list them out in detail).
The code implementation I have is-
With this code we are getting below error on customer SFTP server- Permission denied
The permission detail that customer has highlighted to us is - The file on sftp server has read permission. The directory has read & execute permissions.
However Customer is able to drag and download the file using WinSCP.
I tried the same permission on my local openssh server but I did not face any issue.
Now , when I replace io.Copy with io.ReadAll - the code works fine but for file size less than 190kb. io.ReadAll fails for filesize greater than 190kb and error received is "Bad Message"(SSH_FX_BAD_MESSAGE)
What could be the possible reason to run into this issue? and can you suggest some solution alternate to io.Copy which could possibly fix the issue?
The text was updated successfully, but these errors were encountered: