WGET Shared Folder with password protection

Hey, i try to download files from nextcloud via wget.

If i use a public link to a specific file it works, but if i want to download a folder i just get this: This is the WebDAV interface. It can only be accessed by WebDAV clients such as the Nextcloud desktop sync client.

wget -qO- --user ${SHARE_ID} --password ${NEXTCLOUD_PASSWORD} https://xxxxxxxxxxxxxxx/ | tar -xz

I think this is correct link.

https://cloud.server.tld/index.php/s/xtj85fQ8w78WyHb/download
(index.php is optional)

Use the public shared link and add “/download”.
Please post on error full link (e.g. only without your domain see example above):

But how can i handle it with a password?

If you use the complicated url (xtj85fQ8w78WyHb) and password (mysecretpassword) in the same command you can also miss it. There is no security advantage. Nobody guess the url name.

With passwords i think there are problems with cookies and token (post request) in this sequense:

GET https://cloud.server.tld/index.php/s/nojAmsqZ9yzswdr

getting or creating some cookies and token, redirect to insert public share password

POST https://cloud.server.tld/index.php/s/nojAmsqZ9yzswdr/authenticate/showShare

POST parameter: requesttoken, password, sharingToken

GET https://cloud.server.tld/index.php/s/nojAmsqZ9yzswdr

I found a way:

wget --user=54321 --password=12345 “https://website.xy/nextcloud/remote.php/dav/files/54321/Test/test.txt

Maybe its not the best, it seems to be slow at the request, but it works like i need it

Really? Is “54321” the file-id (shown in user-GUI) and “12345” a public share password? Normally you can define more than one public share with different passwords.

Where do you define the password for the file?

It is the user i created, not the file itsself.

I dont use a shareed link now, i use a user to access my folder.

54321 = Username
12345 = Password of that Account