I had originally posted this in the ‘support’ category, but it might fit here better. Note that the username, password, and IP address in the below information are dummy values for the post. No need to tell me 123.456.789.101 is an invalid IPv4 address
I am encountering an issue using nextcloudcmd to automate upload of a file to the server. According to the ‘Credential Handling’ section in the Advanced Usage section of the documentation,
"nextcloudcmd requires the user to specify the username and password using the standard URL pattern, e.g.,
$ nextcloudcmd /home/user/my_sync_folder https://carla:secret@server/nextcloud
(emphasis mine)
When I attempt to upload, I get a host not found error. The URL shown is not the URL I entered on the command line. Note that in the below example, I am using fake information, as this URL is an internal URL.
I enter:
nextcloudcmd --non-interactive --trust /var/opt/LincolnRadioJournal/ https://'user':'P@ssw0rd!'@123.456.789.101/LRJ
In the output from the command, I see the following as the first line:
01-05 12:03:27:627 [ info nextcloud.sync.accessmanager ]: 2 "" "http://https//user:P@ssw0rd!@123.456.789.101/LRJ/ocs/v1.php/cloud/capabilities?format=json" has X-Request-ID "5688e5f0-9e49-4256-bc4c-c3a9fcf3329b"
If I drop the ‘https://’ from the URL, then the connection shows just the user:P@ssw0rd!@123.456.789.101… as the URL - no protocol, and the connection fails the same way - host not found. The full output from the command looks like this:
01-05 12:03:27:627 [ info nextcloud.sync.accessmanager ]: 2 "" "http://https//user:P@ssw0rd!@123.456.789.101/LRJ/ocs/v1.php/cloud/capabilities?format=json" has X-Request-ID "5688e5f0-9e49-4256-bc4c-c3a9fcf3329b"
01-05 12:03:27:629 [ info nextcloud.sync.networkjob ]: OCC::JsonApiJob created for "http://https//user:P@ssw0rd!@123.456.789.101/LRJ" + "ocs/v1.php/cloud/capabilities" ""
01-05 12:03:27:692 [ warning nextcloud.sync.networkjob ]: QNetworkReply::HostNotFoundError "Host https not found" QVariant(Invalid)
01-05 12:03:27:692 [ info nextcloud.sync.networkjob.jsonapi ]: JsonApiJob of QUrl("http://https//user:P@ssw0rd!@123.456.789.101/LRJ/ocs/v1.php/cloud/capabilities?format=json") FINISHED WITH STATUS "HostNotFoundError Host https not found"
01-05 12:03:27:692 [ warning nextcloud.sync.networkjob.jsonapi ]: Network error: "ocs/v1.php/cloud/capabilities" "Host https not found" QVariant(Invalid)
01-05 12:03:27:692 [ debug default ] [ main(int, char**)::<lambda ]: Server capabilities QJsonObject()
If I use the --user and --password parameters instead, the URL is not mangled, but it also fails to connect with ‘Host requires authentication’:
wmssnm01$ nextcloudcmd --non-interactive --trust --user 'user' --password 'P@ssw0rd' /var/opt/LincolnRadioJournal/ https://123.456.789.101/LRJ
01-05 12:12:29:573 [ info nextcloud.sync.accessmanager ]: 2 "" "https://123.456.789.101/LRJ/ocs/v1.php/cloud/capabilities?format=json" has X-Request-ID "347a52f8-8525-4847-9e29-fa6d5b6e5446"
01-05 12:12:29:573 [ info nextcloud.sync.networkjob ]: OCC::JsonApiJob created for "https://123.456.789.101/LRJ" + "ocs/v1.php/cloud/capabilities" ""
01-05 12:12:29:581 [ info nextcloud.sync.account ]: "SSL-Errors happened for url \"https://123.456.789.101/LRJ/ocs/v1.php/cloud/capabilities?format=json\" \tError in QSslCertificate(\"3\", \"04:ed:cf:5e:c3:a3:26:91:85:55:81:7c:a5:83:c3:a9:db:83\", \"JDU9+3FpsCj9pkEv5jltDQ==\", \"E6\", \"ingest.wmssfm.com\", QMap((1, \"ingest.wmssfm.com\")), QDateTime(2024-12-13 01:32:22.000 UTC Qt::UTC), QDateTime(2025-03-13 01:32:21.000 UTC Qt::UTC)) : \"The host name did not match any of the valid hosts for this certificate\" ( \"The host name did not match any of the valid hosts for this certificate\" ) \n " Certs are known and trusted! This is not an actual error.
01-05 12:12:30:732 [ warning nextcloud.sync.networkjob ]: QNetworkReply::AuthenticationRequiredError "Host requires authentication" QVariant(int, 401)
01-05 12:12:30:732 [ info nextcloud.sync.networkjob.jsonapi ]: JsonApiJob of QUrl("https://123.456.789.101/LRJ/ocs/v1.php/cloud/capabilities?format=json") FINISHED WITH STATUS "AuthenticationRequiredError Host requires authentication"
01-05 12:12:30:732 [ warning nextcloud.sync.networkjob.jsonapi ]: Network error: "ocs/v1.php/cloud/capabilities" "Host requires authentication" QVariant(int, 401)
01-05 12:12:30:732 [ debug default ] [ main(int, char**)::<lambda ]: Server capabilities QJsonObject()
Error connecting to server
wmssnm01$
Note the SSL cert failure is expected, as the cert is for the public FQDN of the server, not the internal address - and I am having an issue with splitting the DNS at the moment, but unrelated to this (other clients connect just fine internally).
I am using this to automate retrieval/ingestion of programming into a broadcast automation system for an educational FM radio station. I have a script that executes (via CRON) on a utility server that retrieves the program from the originator website then uses nextcloudcmd to put it into a specific directory for the automation system to pick up, process, and import. I have several programs that are imported this way, plus a number of external programs (church services we air on Sundays) that are uploaded via the internet for automatic ingestion into the automation playout system for air. Those are working fine, as they are using either the web interface or a full client. Only the scripted retrievals are having the problem.