Downloading a password protected shared file from commandline

I've looked at many different resources, trying to figure out how to do this, but I haven't had any luck - I shared a file and I have a URL in this format

https://owncloud.example.com/index.php/s/<file ID>/download

and it is password protected. How do I use curl or wget to download the file?

I have files I want to allow others to download directly to their Linux machine instead of them needing to download it on their machine then moving it to their server.

I was looking at some examples and they mentioned the use of webdav to do it, but I wasn't able to figure out the correct way to set this up.

Thanks

Hi,

you can access public shared links via WebDAV and curl like explained here:

https://doc.owncloud.org/server/latest/user_manual/files/access_webdav.html#accessing-public-shares-over-webdav

1 Like

Alright thanks, I got it. It looks like this:

curl -u "<share token>:<password>" "https://owncloud.example.com/public.php/webdav" -o <filename>

3 Likes

What shall I do If only password is needed ?
curl -u “’’:‘test123’” “https://cloud.abc.co.uk/s/523aX3O8B5uOWlP” -o wowfile
I tried this but didn’t work

basically user credentials are not required but just a password.

Hey,

it seems an example was given previously how to access a file from a shared link which is protected by a password:

I have shared a password protected file and have the pubic link for it.I am unable to download using the command
curl -u “share token:password” “https://xxx/yyy/remote.php/dav/files/hhh/” -o abc.csv

How do I know what my token is if I only have the file id and the password, as shown in the initial question

Taking as example the url from @Prajkta_Patkar :slight_smile:

 “https://cloud.abc.co.uk/s/523aX3O8B5uOWlP” 

The file is wowfile
The password is test123
The token is: 523aX3O8B5uOWlP

As @tom42 and @francislavoie ancislavoie explained:

curl -u "523aX3O8B5uOWlP:test123" "https://cloud.abc.co.uk/public.php/webdav" -o wowfile
1 Like