SFTP to my server gets 'Failed to lsd: stat of non-regular file/dir failed: file does not exist'

I am trying to set up SFTP access for my MacBook to access files stored on my “file server” (a desktop running Arch Linux). I currently have it configured to prompt for a password. Every time I try to run an rclone command I get an error like this:

Enter SFTP password:
2019/01/25 20:44:21 ERROR : : error listing: stat of non-regular file/dir failed: file does not exist
2019/01/25 20:44:21 Failed to lsd: stat of non-regular file/dir failed: file does not exist

I have successfully been able to connect to localhost as well as another Arch Linux SSH server I have access to, but I need access to this particular file server. Other SFTP clients (eg. Cyberduck) have no issue connecting to this machine.

Any suggestions for trouble shooting steps?

Can you run the command again with -vv and post the complete output?

The error message stat of non-regular file/dir failed: file does not exist suggests that the destination directory does not exist.

Note that if you use sftpremote:file vs sftpremote:/file the first will be looking for file in your home directory, then second in the root.

$ rclone -vv lsd test-remote:
2019/01/27 20:31:53 DEBUG : rclone: Version "v1.45" starting with parameters ["rclone" "-vv" "lsd" "test-remote:"]
2019/01/27 20:31:53 DEBUG : Using config file from "/Users/benjamin.bergman/.config/rclone/rclone.conf"
Enter SFTP password:
2019/01/27 20:32:01 ERROR : : error listing: stat of non-regular file/dir failed: file does not exist
2019/01/27 20:32:01 Failed to lsd: stat of non-regular file/dir failed: file does not exist

What have you got in your config?

What does rclone config show test-remote show? (XXX out usernames, passwords and anything else you thing is private).

Can you use the sftp client?

eg

sftp user@example.com
Connected to example.com.
sftp> ls

Is the home directory a symlink? That might be causing the problem…

--------------------
[test-remote]
type = sftp
host = url.to-my.domain
user = myusername
ask_password = true
port = 2257
--------------------

sftp client works just fine.

My home directory is not a symlink as far as I can tell. It is also on the same partition as /.

Hmmm…

What happens if you do

rclone -vv lsd test-remote:/

Does that work?

Huh, that seems to work (a bit slowly, but could just be because the server is on a home network and not where I am right now).

rclone -vv lsd test-remote:/home/myusername still fails though.

$ rclone -vv lsd test-remote:/home/myusername
2019/01/28 09:12:56 DEBUG : rclone: Version "v1.45" starting with parameters ["rclone" "-vv" "lsd" "test-remote:/home/myusername"]
2019/01/28 09:12:56 DEBUG : Using config file from "/Users/benjamin.bergman/.config/rclone/rclone.conf"
Enter SFTP password:
2019/01/28 09:13:05 ERROR : : error listing: stat of non-regular file/dir failed: file does not exist
2019/01/28 09:13:05 Failed to lsd: stat of non-regular file/dir failed: file does not exist

OK that is interesting!

I see what the problem is… You’ve got a dangling symlink in your home directory.

Try this which should do the correct thing.

https://beta.rclone.org/branch/v1.45-124-g47f25348-fix-sftp-dangling-link-beta/ (uploaded in 15-30 mins)

1 Like

Just wanted to say thank you for this SFTP fix in the beta. I had the same issue as the OP and this has fixed it for me.

Great - thanks :smile:

Thanks for testing it dbsw. I haven’t had a chance to get back to this, but look forward to trying it out.

Aside: one of my reasons for trying rclone is I see it has a few caching features. Can any of these be used to copy files locally temporarily when first opened for use offline? The documentation was a bit unclear. My primary use case is for editing video stored on a large file server as fast as possible (ie. copied on local SSD) and available in the event that I’m not on the local network (assuming I have opened the project recently).

rclone has the cache backend and the vfs cache, both of which can copy files locally temporarily. Not sure how well it will work if there is no network access though. Be worth experimenting!

I had this issue as well using v1.45 and v1.46 resolves it (I’m guessing this was rolled into that release?) Thanks!

Yes it was included in v1.46 :slight_smile:

Hello,

I face the same problem on a i386 arch, and the latest version version for this architecture seems to be the 1.45-3. Do you plan to release a 1.46 with this fixed for i386 too ?

Regards.

You should find the fix in the latest release - this has i386 builds too. See the download page.

Sorry for not even checking the download page, I just assumed the most recent one available in my MX repository was up to date.
Thanks, it works like a charm now.

1 Like