Hi I am trying to start a reboot of the rapsberry from fhem with:
system("sudo reboot &");
I tried this:
http://ueberueck.com/index.php/fhem-hausautomatisierung/fhem-how-to-s/raspberry-aus-fhem-neu-starten
In my password file I have:
fhem:x:999:20::/opt/fhem:/bin/bash
In groups I have:
sudo:x:27:pi,fhem
In the fhem logging I get:
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
sudo: no tty present and no askpass program specified
Has anybody succeeded in getting this to work? If so, how?
Thanks
What do you have in /etc/sudoers ?
Hi
my /etc/sudoers: ( it is the standard version. as far as I see, it is sufficient to add fhem to the group sudoers)
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
Zitat von: HarryT am 14 Juli 2017, 15:56:21
%sudo ALL=(ALL:ALL) ALL
That would need to be
%sudo ALL=(ALL:ALL) NOPASSWD: ALL
or better still
fhem ALL=(root) NOPASSWD: /sbin/shutdown
Cool
fhem ALL=(root) NOPASSWD: /sbin/shutdown
worked.
BTW I guess adding fhem to the sudoers group is not necessary when this line is add to the sudoers file?
Thanks
Zitat von: HarryT am 14 Juli 2017, 18:26:05
BTW I guess adding fhem to the sudoers group is not necessary when this line is add to the sudoers file?
Right.