I would like to know if it is possible to automatically download files behind a share, protected by password from command line…or just connect to a shared folder from command line, which is password protected?
Is there an endpoint in the nextcloud API allowing it?
Thank you for your help
That’s an easy task. The server provides WebDAV endpoints and you can e.g. use davfs2 to mount such a share on the command line to access its content.
as a startup here’s my /home/username/.davfs2/davfs2.conf as a example
Notice the need to add the /etc/fstab line
# davfs2 configuration file 2014-08-10
# version 12
# Copyright (C) 2006, 2007, 2008, 2009, 2012, 2013, 2014 Werner Baumann
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved.
# Please read the davfs2.conf (5) man page for a description of the
# configuration options and syntax rules
# ADD the line below to your /etc/fstab and mkdir -p /media/USERNAME/cloud
# https://cloud.domain.com/remote.php/webdav/ /media/USERNAME/cloud davfs rw,user,noauto 0 0
# Available options and default values
# General Options
# dav_user davfs2 # system wide config file only
# dav_group davfs2 # system wide config file only
# kernel_fs fuse
# buf_size 16 # KiByte
# WebDAV Related Options
# Cache Related Options
# backup_dir lost+found
# cache_dir /var/cache/davfs2 # system wide cache
cache_dir ~/.davfs2/cache # per user cache
cache_size 50 # MiByte
# table_size 1024
dir_refresh 600 # seconds
file_refresh 60 # second
# delay_upload 10
# Debugging Options
# debug # possible values: config, kernel, cache, http, xml,
# httpauth, locks, ssl, httpbody, secrets, most
in the file /home/username/.davfs2/secret
https://cloud.domain.com/remote.php/webdav/ "USERNAME" "PASSWORD"
chmod 400 secret
thank you for your quick answers…in fact, I want to give acces files to my external users …and offer them an easy way to download their files, just with one command line. They don’t have accounts on our nexcloud instance.
I would like to share files with a public link and password…
I found a post in this forum that corresponds exactly to my need (Using curl/wget to download file from password protect link), but, unfortunately, an error raises
Command executed :
curl -u "c7MMk2AAN8nPZBD:oReFfEE4sds" -H "X-Requested-With: XMLHttpRequest" https://nextcloud.myinstance.fr/public.php/webdav/
Error received :
This is the WebDAV interface. It can only be accessed by WebDAV clients such as the Nextcloud desktop sync client
I guess this is a nexcloud config issue…I will try to find more information on it…