Hello.
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 user@host -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 user@host -p port sudo reboot') ***
Anybody can help me please ?
Many thanks in advance !
Problem with "os.execute" in dzventz
Moderator: leecollings
- emme
- Posts: 909
- Joined: Monday 27 June 2016 11:02
- Target OS: Raspberry Pi / ODroid
- Domoticz version: latest
- Location: Milano, Italy
- Contact:
Re: Problem with "os.execute" in dzventz
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 user@host -p port sudo reboot')
or log as root and connect the remote server the first time to save the key
ciao
M
try with
os.execute('su pi ssh user@host -p port sudo reboot')
or log as root and connect the remote server the first time to save the key
ciao
M
The most dangerous phrase in any language is:
"We always done this way"
"We always done this way"
Who is online
Users browsing this forum: No registered users and 1 guest