Does not work command: http://username:password@domoticz ip:port
Moderators: leecollings, remb0
-
- Posts: 112
- Joined: Tuesday 13 September 2016 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Contact:
Does not work command: http://username:password@domoticz ip:port
hi gays
i want use command http://username:password@domoticz ip:port
but does not work and when i enter this , open login page and request username and password.
also when i want send this command :
http://username:[email protected]: ... itchcmd=On
i have answer:
401 Unauthorized
i want use command http://username:password@domoticz ip:port
but does not work and when i enter this , open login page and request username and password.
also when i want send this command :
http://username:[email protected]: ... itchcmd=On
i have answer:
401 Unauthorized
- waltervl
- Posts: 5148
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Does not work command: http://username:password@domoticz ip:port
Do you have setting "Allow Basic-Auth authentication over plain HTTP (API only)" enabled in menu setup - Settings, tab security?
Edit: also some browsers do not allow to add user:password so to test you have to use something like curl or postman.
Edit: also some browsers do not allow to add user:password so to test you have to use something like curl or postman.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 101
- Joined: Tuesday 04 March 2014 10:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Surrey, UK
- Contact:
Re: Does not work command: http://username:password@domoticz ip:port
I have also been trying to backup from a curl script with http://username:password@ipaddress/backupdatabase.php and get the same 401 Unauthorized
I have "Allow basic authorisation for HTTP" enabled in setup.
I know the username / password are good as I use them to log in
I have "Allow basic authorisation for HTTP" enabled in setup.
I know the username / password are good as I use them to log in
3 x Pi, 1 Master, 2 Slaves, 1x Aeotec Z-Stick S2, 4xSP103 PIR, 5xPowerNode 1, 1xSmart Energy Switch Gen5, 4xFGSS101 Smoke Sensor, 2xFGD212, 9xFGS212 , 7xFGS221/2, 1xAD142 , 1xTKB TZ68E , 2xAeotec Multi Sensor, 3 x NodOn CRC-3-1-00.
- waltervl
- Posts: 5148
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Does not work command: http://username:password@domoticz ip:port
And that user is an admin? Else it has no right to make a backup.mark.sellwood wrote: ↑Wednesday 24 July 2024 0:22 I know the username / password are good as I use them to log in
Also if you login from an IP in the trusted network range don't give user:password.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 101
- Joined: Tuesday 04 March 2014 10:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Surrey, UK
- Contact:
Re: Does not work command: http://username:password@domoticz ip:port
Yes, the user is an Admin
If I add the Raspberry IP in as a Trusted Networks it works fine with no user:password
If I add the Raspberry IP in as a Trusted Networks it works fine with no user:password
3 x Pi, 1 Master, 2 Slaves, 1x Aeotec Z-Stick S2, 4xSP103 PIR, 5xPowerNode 1, 1xSmart Energy Switch Gen5, 4xFGSS101 Smoke Sensor, 2xFGD212, 9xFGS212 , 7xFGS221/2, 1xAD142 , 1xTKB TZ68E , 2xAeotec Multi Sensor, 3 x NodOn CRC-3-1-00.
-
- Posts: 112
- Joined: Tuesday 13 September 2016 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Contact:
Re: Does not work command: http://username:password@domoticz ip:port
edit : i resolve it with curl. thank you
-
- Posts: 101
- Joined: Tuesday 04 March 2014 10:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Surrey, UK
- Contact:
Re: Does not work command: http://username:password@domoticz ip:port
Could you please let me know the command you are using?
This is waht I gave & am getting the error/
/usr/bin/curl -k "https://user:password@IP_Address/backupdatabase.php" > /home/Mark/tmp/Backup.db
This is waht I gave & am getting the error/
/usr/bin/curl -k "https://user:password@IP_Address/backupdatabase.php" > /home/Mark/tmp/Backup.db
3 x Pi, 1 Master, 2 Slaves, 1x Aeotec Z-Stick S2, 4xSP103 PIR, 5xPowerNode 1, 1xSmart Energy Switch Gen5, 4xFGSS101 Smoke Sensor, 2xFGD212, 9xFGS212 , 7xFGS221/2, 1xAD142 , 1xTKB TZ68E , 2xAeotec Multi Sensor, 3 x NodOn CRC-3-1-00.
-
- Posts: 303
- Joined: Saturday 27 February 2016 0:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
Re: Does not work command: http://username:password@domoticz ip:port
Are there any ":", "@" or "/" in username and/or password?
-
- Posts: 101
- Joined: Tuesday 04 March 2014 10:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Surrey, UK
- Contact:
Re: Does not work command: http://username:password@domoticz ip:port
No, just standard text
3 x Pi, 1 Master, 2 Slaves, 1x Aeotec Z-Stick S2, 4xSP103 PIR, 5xPowerNode 1, 1xSmart Energy Switch Gen5, 4xFGSS101 Smoke Sensor, 2xFGD212, 9xFGS212 , 7xFGS221/2, 1xAD142 , 1xTKB TZ68E , 2xAeotec Multi Sensor, 3 x NodOn CRC-3-1-00.
-
- Posts: 303
- Joined: Saturday 27 February 2016 0:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
Re: Does not work command: http://username:password@domoticz ip:port
It seems you're using https in curl, while using http in first message. Is this an error ?mark.sellwood wrote: ↑Wednesday 24 July 2024 8:39 Could you please let me know the command you are using?
This is waht I gave & am getting the error/
/usr/bin/curl -k "https://user:password@IP_Address/backupdatabase.php" > /home/Mark/tmp/Backup.db
-
- Posts: 101
- Joined: Tuesday 04 March 2014 10:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Surrey, UK
- Contact:
Re: Does not work command: http://username:password@domoticz ip:port
My bad, this is what im using
/usr/bin/curl -s "http://user:password@IP_Address:8080/backupdatabase.php" > /home/Mark/tmp/Backup.db
/usr/bin/curl -s "http://user:password@IP_Address:8080/backupdatabase.php" > /home/Mark/tmp/Backup.db
3 x Pi, 1 Master, 2 Slaves, 1x Aeotec Z-Stick S2, 4xSP103 PIR, 5xPowerNode 1, 1xSmart Energy Switch Gen5, 4xFGSS101 Smoke Sensor, 2xFGD212, 9xFGS212 , 7xFGS221/2, 1xAD142 , 1xTKB TZ68E , 2xAeotec Multi Sensor, 3 x NodOn CRC-3-1-00.
-
- Posts: 303
- Joined: Saturday 27 February 2016 0:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
Re: Does not work command: http://username:password@domoticz ip:port
What's exact error message?
I assume you properly checked user and password, including lower/uppercase.
I assume you properly checked user and password, including lower/uppercase.
-
- Posts: 101
- Joined: Tuesday 04 March 2014 10:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Surrey, UK
- Contact:
Re: Does not work command: http://username:password@domoticz ip:port
In the output file I have
<html><head><title>Unauthorized</title></head><body><h1>401 Unauthorized</h1></body></html>
<html><head><title>Unauthorized</title></head><body><h1>401 Unauthorized</h1></body></html>
3 x Pi, 1 Master, 2 Slaves, 1x Aeotec Z-Stick S2, 4xSP103 PIR, 5xPowerNode 1, 1xSmart Energy Switch Gen5, 4xFGSS101 Smoke Sensor, 2xFGD212, 9xFGS212 , 7xFGS221/2, 1xAD142 , 1xTKB TZ68E , 2xAeotec Multi Sensor, 3 x NodOn CRC-3-1-00.
- waltervl
- Posts: 5148
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Does not work command: http://username:password@domoticz ip:port
For backup issue also see viewtopic.php?p=315818
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 303
- Joined: Saturday 27 February 2016 0:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
Re: Does not work command: http://username:password@domoticz ip:port
I found something...
I just tried the same (curl -k "http://username:password@ip:8080/backupdatabase.php" > Backup.db) with 2024.6 and 2020.2 with success.
I also tried without username and password (curl -k "http://ip:8080/backupdatabase.php" > Backup.db) and it also worked.
Both tests where done with the requesting machine in list of trusted networks in Security tab of Settings.
When removing it from list of trusted networks, I got the same error as you, with and without password (401 errors)
When trying API call (/json.htm?type=command¶m=getversion), everything ran well.
Going back to wiki (RTFM), if found at https://www.domoticz.com/wiki/Security:
As your call is not an API call (not starting with /json.htm), you're not allowed to identify this way. You should either:
Tip: carefully check that trusted networks are separated by a ";" as I had some surprises with a mistyped ","
I just tried the same (curl -k "http://username:password@ip:8080/backupdatabase.php" > Backup.db) with 2024.6 and 2020.2 with success.
I also tried without username and password (curl -k "http://ip:8080/backupdatabase.php" > Backup.db) and it also worked.
Both tests where done with the requesting machine in list of trusted networks in Security tab of Settings.
When removing it from list of trusted networks, I got the same error as you, with and without password (401 errors)
When trying API call (/json.htm?type=command¶m=getversion), everything ran well.
Going back to wiki (RTFM), if found at https://www.domoticz.com/wiki/Security:
Code: Select all
Provide valid credentials via 'Basic-Auth' with each API request. Only accepted for API calls!
- Put machine (or subnet) into trusted network list
- As doc says: Retrieve an 'Access Token' (JWT Token) from the IAM server and provide this Bearer token with each request
Tip: carefully check that trusted networks are separated by a ";" as I had some surprises with a mistyped ","
-
- Posts: 101
- Joined: Tuesday 04 March 2014 10:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Surrey, UK
- Contact:
Re: Does not work command: http://username:password@domoticz ip:port
Thanks for checking that our for me, I was coming to the same conclusion
ie to do a backup the User needs to be an Admin & the IP needs to be Trusted.
ie to do a backup the User needs to be an Admin & the IP needs to be Trusted.
3 x Pi, 1 Master, 2 Slaves, 1x Aeotec Z-Stick S2, 4xSP103 PIR, 5xPowerNode 1, 1xSmart Energy Switch Gen5, 4xFGSS101 Smoke Sensor, 2xFGD212, 9xFGS212 , 7xFGS221/2, 1xAD142 , 1xTKB TZ68E , 2xAeotec Multi Sensor, 3 x NodOn CRC-3-1-00.
-
- Posts: 303
- Joined: Saturday 27 February 2016 0:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2020.2
- Contact:
Re: Does not work command: http://username:password@domoticz ip:port
... or write a small script, on machine having Domoticz, to generate backup locally and copy database to remote machine.
- waltervl
- Posts: 5148
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Does not work command: http://username:password@domoticz ip:port
Or just enable the built in backup mechanism with automated hourly, daily and monthly backups.
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
-
- Posts: 112
- Joined: Tuesday 13 September 2016 9:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.4
- Contact:
Re: Does not work command: http://username:password@domoticz ip:port
in a .py file i use this code:mark.sellwood wrote: ↑Wednesday 24 July 2024 8:39 Could you please let me know the command you are using?
This is waht I gave & am getting the error/
/usr/bin/curl -k "https://user:password@IP_Address/backupdatabase.php" > /home/Mark/tmp/Backup.db
Code: Select all
import pycurl
from io import BytesIO
buffer = BytesIO()
curl = pycurl.Curl()
curl.setopt(pycurl.URL, 'http://username:[email protected]:8080/json.htm?type=command¶m=switchlight&idx=1&switchcmd=On')
curl.setopt(pycurl.USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:120.0) Gecko/20100101 Firefox/120.0")
curl.setopt(pycurl.WRITEDATA, buffer)
curl.perform()
curl.close()
-
- Posts: 101
- Joined: Tuesday 04 March 2014 10:33
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Surrey, UK
- Contact:
Re: Does not work command: http://username:password@domoticz ip:port
Thanks for all your feedback.
I have now enabled the automated backups & once a day I copy the off to my NAS as a off line backup.
I have now enabled the automated backups & once a day I copy the off to my NAS as a off line backup.
3 x Pi, 1 Master, 2 Slaves, 1x Aeotec Z-Stick S2, 4xSP103 PIR, 5xPowerNode 1, 1xSmart Energy Switch Gen5, 4xFGSS101 Smoke Sensor, 2xFGD212, 9xFGS212 , 7xFGS221/2, 1xAD142 , 1xTKB TZ68E , 2xAeotec Multi Sensor, 3 x NodOn CRC-3-1-00.
Who is online
Users browsing this forum: No registered users and 1 guest