Nextcloud Connection Failure

What is the problem you are having with rclone?

Unable to connect and sync with nextcloud instance.
I'm trying to setup rclone on my octoprint raspberry pi to send it's backups, GCode, and timelapses to my nextcloud server.
I have webdav working with this server for another item (my phone), so that's working.

Any help is appreciated.

What is your rclone version (output from rclone version)

pi@octopi:~ $ rclone version
rclone v1.57.0
- os/version: raspbian 10.11
- os/kernel: 5.10.63-v7l+ (armv7l)
- os/type: linux
- os/arch: arm
- go/version: go1.17.2
- go/linking: static
- go/tags: none

Which cloud storage system are you using? (eg Google Drive)

Nextcloud (personal)

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone sync ~/scripts/ nextcloud:/OctoPi/scripts

The rclone config contents with secrets removed.

[nextcloud]
type = webdav
url = https://nextcloud.mydomain.com/remote.php/webdav/
vendor = nextcloud
user = lordbob75
bearer_token = redacted (app password)
pass = redacted (user password)

A log from the command with the -vv flag

pi@octopi:~ $ rclone sync ~/scripts/ nextcloud:/OctoPi/scripts/ -vv
2021/12/17 12:59:06 DEBUG : rclone: Version "v1.57.0" starting with parameters ["rclone" "sync" "/home/pi/scripts/" "nextcloud:/OctoPi/scripts/" "-vv"]
2021/12/17 12:59:06 DEBUG : Creating backend with remote "/home/pi/scripts/"
2021/12/17 12:59:06 DEBUG : Using config file from "/home/pi/.config/rclone/rclone.conf"
2021/12/17 12:59:06 DEBUG : Creating backend with remote "nextcloud:/OctoPi/scripts/"
2021/12/17 12:59:06 DEBUG : found headers: 
2021/12/17 12:59:06 DEBUG : fs cache: renaming cache item "nextcloud:/OctoPi/scripts/" to be canonical "nextcloud:OctoPi/scripts"
2021/12/17 12:59:13 ERROR : webdav root 'OctoPi/scripts': error reading destination root directory: couldn't list files: OCA\DAV\Connector\Sabre\Exception\PasswordLoginForbidden: 401 Unauthorized
2021/12/17 12:59:13 DEBUG : webdav root 'OctoPi/scripts': Waiting for checks to finish
2021/12/17 12:59:13 DEBUG : webdav root 'OctoPi/scripts': Waiting for transfers to finish
2021/12/17 12:59:13 ERROR : webdav root 'OctoPi/scripts': not deleting files as there were IO errors
2021/12/17 12:59:13 ERROR : webdav root 'OctoPi/scripts': not deleting directories as there were IO errors
2021/12/17 12:59:13 ERROR : Attempt 1/3 failed with 1 errors and: couldn't list files: OCA\DAV\Connector\Sabre\Exception\PasswordLoginForbidden: 401 Unauthorized

hi,
not an expert but based on other topics in the fourm, and based on the docs
use just bearer_token without pass

https://rclone.org/webdav/#webdav-bearer-token
"Bearer token instead of user/pass"

Ok, I updated it to use no password and only the app password as the bearer_token:

pi@octopi:~ $ rclone sync ~/scripts/ nextcloud:/OctoPi/scripts/ -vv
2021/12/17 13:50:33 DEBUG : rclone: Version "v1.57.0" starting with parameters ["rclone" "sync" "/home/pi/scripts/" "nextcloud:/OctoPi/scripts/" "-vv"]
2021/12/17 13:50:33 DEBUG : Creating backend with remote "/home/pi/scripts/"
2021/12/17 13:50:33 DEBUG : Using config file from "/home/pi/.config/rclone/rclone.conf"
2021/12/17 13:50:33 DEBUG : Creating backend with remote "nextcloud:/OctoPi/scripts/"
2021/12/17 13:50:33 DEBUG : found headers: 
2021/12/17 13:50:33 DEBUG : fs cache: renaming cache item "nextcloud:/OctoPi/scripts/" to be canonical "nextcloud:OctoPi/scripts"
2021/12/17 13:50:40 ERROR : webdav root 'OctoPi/scripts': error reading destination root directory: couldn't list files: OCA\DAV\Connector\Sabre\Exception\PasswordLoginForbidden: 401 Unauthorized
2021/12/17 13:50:40 DEBUG : webdav root 'OctoPi/scripts': Waiting for checks to finish
2021/12/17 13:50:40 DEBUG : webdav root 'OctoPi/scripts': Waiting for transfers to finish
2021/12/17 13:50:40 ERROR : webdav root 'OctoPi/scripts': not deleting files as there were IO errors
2021/12/17 13:50:40 ERROR : webdav root 'OctoPi/scripts': not deleting directories as there were IO errors
2021/12/17 13:50:40 ERROR : Attempt 1/3 failed with 1 errors and: couldn't list files: OCA\DAV\Connector\Sabre\Exception\PasswordLoginForbidden: 401 Unauthorized

better to test using rclone lsd and/or rclone ls before trying rclone sync

what app are you using, rclone on termux or what?
and what info did you type into the app?

well, that is what other rcloners seem to do and what the documentation states.
i would search the forum, as there were a few recents topics about your issue.

Ah, thanks. Will do.

I'm using the nextcloud android app and the joplin android app. The joplin one specifically uses a webdav link. I'm going to try using that link instead next too.

Right, and I did try that before, although I didn't find the documentation very clear about it.

I totally missed them if so. I'll go check again.

well, might try this one, which is giving somewhat different advice.

https://forum.rclone.org/t/unable-to-connect-icedrive-via-webdav/27830/3?u=asdffdsa

No luck there either. It looks like it works with the rclone lsd switch now, but when actually trying a test folder it's still not working. 403 errors this time.

pi@octopi:~ $ rclone lsd nextcloud:/OctoPi/ -vv
2021/12/17 14:12:54 DEBUG : rclone: Version "v1.57.0" starting with parameters ["rclone" "lsd" "nextcloud:/OctoPi/" "-vv"]
2021/12/17 14:12:54 DEBUG : Creating backend with remote "nextcloud:/OctoPi/"
2021/12/17 14:12:54 DEBUG : Using config file from "/home/pi/.config/rclone/rclone.conf"
2021/12/17 14:12:54 DEBUG : found headers: 
2021/12/17 14:12:54 DEBUG : fs cache: renaming cache item "nextcloud:/OctoPi/" to be canonical "nextcloud:OctoPi"
          -1 2021-12-09 15:53:05        -1 Backup
          -1 2021-12-17 10:32:46        -1 GCode
          -1 2021-12-09 15:52:32        -1 Timelapse
          -1 2021-12-17 10:32:54        -1 scripts
2021/12/17 14:13:01 DEBUG : 3 go routines active
pi@octopi:~ $ rclone sync ~/scripts/ nextcloud:/OctoPi/scripts/ -vv
2021/12/17 14:13:08 DEBUG : rclone: Version "v1.57.0" starting with parameters ["rclone" "sync" "/home/pi/scripts/" "nextcloud:/OctoPi/scripts/" "-vv"]
2021/12/17 14:13:08 DEBUG : Creating backend with remote "/home/pi/scripts/"
2021/12/17 14:13:08 DEBUG : Using config file from "/home/pi/.config/rclone/rclone.conf"
2021/12/17 14:13:08 DEBUG : Creating backend with remote "nextcloud:/OctoPi/scripts/"
2021/12/17 14:13:08 DEBUG : found headers: 
2021/12/17 14:13:08 DEBUG : fs cache: renaming cache item "nextcloud:/OctoPi/scripts/" to be canonical "nextcloud:OctoPi/scripts"
2021/12/17 14:13:15 DEBUG : webdav root 'OctoPi/scripts': Waiting for checks to finish
2021/12/17 14:13:15 DEBUG : webdav root 'OctoPi/scripts': Waiting for transfers to finish
2021/12/17 14:13:37 ERROR : install-desktop: Failed to copy: Sabre\DAV\Exception\Forbidden: 403 Forbidden
2021/12/17 14:13:37 ERROR : add-octoprint-checkout: Failed to copy: Sabre\DAV\Exception\Forbidden: 403 Forbidden
2021/12/17 14:13:37 ERROR : ensure-octoprint-default-user: Failed to copy: Sabre\DAV\Exception\Forbidden: 403 Forbidden
2021/12/17 14:13:37 ERROR : backupScript.sh: Failed to copy: Sabre\DAV\Exception\Forbidden: 403 Forbidden
2021/12/17 14:13:58 ERROR : safemode: Failed to copy: Sabre\DAV\Exception\Forbidden: 403 Forbidden
2021/12/17 14:13:58 ERROR : welcome: Failed to copy: Sabre\DAV\Exception\Forbidden: 403 Forbidden
2021/12/17 14:13:58 ERROR : webdav root 'OctoPi/scripts': not deleting files as there were IO errors
2021/12/17 14:13:58 ERROR : webdav root 'OctoPi/scripts': not deleting directories as there were IO errors
2021/12/17 14:13:58 ERROR : Attempt 1/3 failed with 6 errors and: Sabre\DAV\Exception\Forbidden: 403 Forbidden

good, we are making progress. 403 is better than 401
403 - that means you are authorized but lacking permissions for certain operations.

Right and I'd gotten there before, but I guess that means it's a Nextcloud issue.

I'd searched for this before and not found much, but just saw something about someone having a similar permissions issue and having to delete and recreate the folder. I just did that and it works!

So thanks much for your help, I should be set now. I'm going to go test out the full script and make sure that works too though.

403 is a server issue, not a client issue

Right, which is why I was confused because I had webdav working with this username for other applications.

Either way it definitely appears to be working correctly now! My script is pushing data over perfectly. Just taking a while for the initial sync.

Thanks again!

sure, good

can you post the redacted config file that worked?

Sure thing:

pi@octopi:~ $ rclone config show
[nextcloud]
type = webdav
url = https://nextcloud.mydomain.com/remote.php/webdav/OctoPi/
vendor = nextcloud
user = lordbob75
pass = _app-password_
1 Like

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