Closed Wykiki closed 2 weeks ago
Created PR #58 in case you're willing to accept the contribution.
Try replacing 3rd argument with
FileAttributes {
size: None,
uid: None,
user: None,
gid: None,
group: None,
permissions: None,
atime: None,
mtime: None
}
and let me know if this solves the problem
Thanks for guidance, here is what I tried :
// Works
let metadata = session.metadata(&file).await.unwrap();
// Works
let metadata = FileAttributes {
size: None,
uid: None,
user: None,
gid: None,
group: None,
permissions: None,
atime: None,
mtime: None,
};
// Works
let metadata = FileAttributes {
size: None,
uid: None,
user: None,
gid: None,
group: None,
permissions: Some(0o755 | OpenFlags::READ.bits()),
atime: None,
mtime: None,
};
// Does not work
let metadata = FileAttributes {
permissions: Some(0o755 | OpenFlags::READ.bits()),
..Default::default()
};
Above results have been tested against the unknown remote SFTP server.
I also tried them against the following SFTP server, working for every cases : https://github.com/atmoz/sftp
Now, by default, the setting of attributes is delegated to the server, since according to the standard, it should set them at its own discretion by default. https://github.com/AspectUnk/russh-sftp/commit/ce779cec66c876ef9da32c38e61143d590b3899e
Your problem is strange, because attributes are initial and should be processed by the server only when creating the file, but not when opening it, anyway everything should work for you now
I confirm that the new behaviour makes the session.open(&file)
work as expected on my side.
Thanks a lot for your time !
Hello !
I am fetching file on a remote SFTP server, for which I don't have much information regarding its version, its platform, or anything else. I am able to
sftp ls
andsftp get
files.When I try to
session.metadata()
a file, it works, but when I try tosession.open()
it, it does fail with aPermissionDenied
error.After digging and trying things on the
russh_sftp
codebase, I successfully read the file only if I send the whole file metadata when opening it, like this :I'm absolutely not a sftp expert, so I'm not sure if this behaviour is expected on some server implementations, and I don't know if I can submit a PR to fix this issue on
russh_sftp
, or if I should fix it on my side via a fork (because I don't see how I can do it without forking).If you're willing to accept a PR, would you prefer :
metadata
reuse directly in theopen
methodFileAttributes
Thanks for reading !