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

#1

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?

0 Likes

#2

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.

0 Likes

#3
$ 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
0 Likes

#4

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…

0 Likes

#5
--------------------
[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 /.

0 Likes

#6

Hmmm…

What happens if you do

rclone -vv lsd test-remote:/

Does that work?

0 Likes

#7

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
0 Likes

#8

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

#9

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.

0 Likes

#10

Great - thanks :smile:

0 Likes

#11

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).

0 Likes

#12

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!

0 Likes

#13

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

0 Likes

#14

Yes it was included in v1.46 :slight_smile:

0 Likes