I am using nextcloud 18 and I would like to know if there is a way to download a shared file from a link that it is password protected using curl or wget.
I have a shared file protected by password on this url: https://nextcloud.somedomain.com/index.php/s/62NNQGyXvWTJbsp/download
When accessing that link on the browser, I am presented with this screen:
And after typing the password, the download begins.
I need to automate that process to download using command line tools like curl or wget, but I have not found a way to do it.
Note that there is no USERNAME involved in the process, just a password. So using , for example, curl -u user:password
wont work.
Hi, it seems to work when the protected public link is done for a file, but not for a folder.
I get the following message in the latter case : This is the WebDAV interface. It can only be accessed by WebDAV clients such as the Nextcloud desktop sync client.
Example: https://cloud.server.tld/s/bXLNwQgokLTAdLB/download?path=/&files=filename.extension
or https://cloud.server.tld/s/bXLNwQgokLTAdLB/download?path=/&file=filename.extension
I think the path is relative. You can also use in the same folder it without “path”:
https://cloud.server.tld/s/bXLNwQgokLTAdLB/download?files=filename.extension
or https://cloud.server.tld/s/bXLNwQgokLTAdLB/download?file=filename.extension
It doesn’t work for me. I have a password protected shared directory and I want to be able to download only one file from it using a simple command in a console. I know about davfs2, but it’s too complicated for my scenario, I’m wondering, maybe there is a simpler solution, like curl -u "shareID:passWD" -H "X-Requested-With: XMLHttpRequest" "https://some.share.com/public.php/webdav?file=specific_file.zip" --output specific_file.zip
?
Yes. But I think you must not use “public.php/webdav” but “s” in the path. See then i think there is a problem with the password because the uses cookies …
Yay! I finally found a solution for my and @gsalin problem!
It’s really simple and doesn’t require any additional installations, like davfs2.
If you have password protected shared directory, and you need to download only one file from it, you just need to place the specific file name in the url after “…public.php/webdav/”. So the resulting bash command will be like this: curl -u "shareID:passWD" -H "X-Requested-With: XMLHttpRequest" "https://some.share.com/public.php/webdav/specific_filename.zip" -o specific_filename.zip
First thank you for your code. I was able to download a single file from a shared directory. However I am unable to download a single shared file in a non-shared directory. Any direction on how to do this?