Rclone RC api 'operations/stat' is not working for SFTP remotes

Hello experts,

I am using rclone in RC mode and using 'operations/stat' api to identify whether given file system is directory or file.
It works fine with AWS, ADLS and Local File system also.

But with SFTP its not giving any response.
At the same time 'lsjson' command for SFTP remote is working in command line mode rclone.

rclone --version
rclone v1.57.0

Thanks
Mahendra

Hi Mahendra,

I can reproduce your observation and work around it by removing the / in front of your SFTP path (on a Synology SFTP server.)

I therefore suggest you try using "opt/... as remote, not "/opt/..."

Leading / can be quite tricky on SFTP servers as you can see in the first paragraphs of these two pages:
https://rclone.org/sftp/
https://rclone.org/sftp/#limitations

Thanks for the quick help @Ole .

In my case removing "/" also did not help.

Its issue only with this sftp/ssh remote which I created using private key file.

I have few more sftp remotes with username and password there its working fine.

For this 'operations/stat' does not work but directory/file transfer (using "sync/copy") works fine

Thanks
Mahendra

Hi Mahendra,

Hmm, that sure sounds strange, perhaps a bug, but I doubt it is related to the authentication.

Can you try the troubling server using username password?
Can you tell some more about the troubling server? OS? SFTP server software? Special settings? Something publicly available so we can try to replicate?

@ncw Any immediate ideas why leading / in (SFTP) paths seem to be treated differently between operations/stat and sync/copy?

We have this Ec2 instance in AWS cloud.

root@ip-10-0-10-200:/home/ubuntu# cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.5 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.5 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="Data privacy | Ubuntu"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic

Using private key I created remote for this server (ubuntu server be default comes with sftp shipped if I am not wrong)

Rclone Remote :

root@nifi12-dev:/home/ubuntu# rclone config show Int3-SFTP-Server

[Int3-SFTP-Server]
type = sftp
disable_hashcheck =
host = 10.0.10.200
key_file = /home/ubuntu/Rclone/private.key
key_use_agent =
password =
port = 22
pubkey_file =
key_pem =
user = ubuntu
md5sum_command = md5sum
sha1sum_command = sha1sum

Thanks, interesting.

Did you try using username and password to this server?
(I am asking because I used a private key in my Synology example and didn't see the issue)

This turned out to be a little bug in the sftp backend.

Give this a go - I think it should fix the problem

v1.61.0-beta.6630.5aa13deb9.fix-sftp-stat on branch fix-sftp-stat (uploaded in 15-30 mins)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.