Problem with "os.execute" in dzventz

Post Reply
Posts: 2
Joined: Thursday 18 January 2018 10:42
Target OS: -
Domoticz version:

Problem with "os.execute" in dzventz

Post by cdjseb » Thursday 18 January 2018 11:00

I'm making a script for rebooting a computer.
When i'm connect to domoticz with SSH, i have a command who is working :

*** ssh [email protected] -p port sudo reboot *** (user / host / port are different obviously)

but when i include this command in my script, it's not working !

*** os.execute('ssh [email protected] -p port sudo reboot') ***

Anybody can help me please ?
Many thanks in advance !

User avatar
Posts: 780
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi
Domoticz version: latest
Location: Milano, Italy

Re: Problem with "os.execute" in dzventz

Post by emme » Thursday 18 January 2018 12:30

the problem is that in ssh you run the command ad user PI, but domoticz runs as root for which (probably) there is no SSH key exchange between the 2 servers.

try with
os.execute('su pi ssh [email protected] -p port sudo reboot')

or log as root and connect the remote server the first time to save the key

That's one small step for a programmer, one giant leap for me!
- - - - -
Raspberry Pi3 + AeonStick G5 + RFXCOMM433 + iRTrans Server + NodeJS
There's no stress in the mess!!

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests