[SOLVED] Openhab 2 and executeCommandLine / Exec

Sorry, that’s going back a while…
Which code?

For what it’s worth, I just got executeCommandLine running under Centos 7 with selinux enabled. These are my notes:

To execute commands in rules using executeCommandLine (“command”, [timeout]), you need to add the openhab and the desired commands
to the sudoers file using:

visudo

At the bottom of the file add:

#add openhab
openhab i7NUC=(root) NOPASSWD: /usr/bin/echo, etc…

Then edit the entry for openhab in /etc/passwd to set the shell as bash:

openhab:x:996:994::/var/lib/openhab2:/bin/bash

Then change the uid and gid logon thresholds to allow openhab to sudo in /etc/login.defs

UID_MIN 996
.
.
.
GID_MIN 994

Then update the pam auth stuff via:

authconfig --update

Next add the following lines to /etc/pam.d/sudo

Fixing ssh “auth could not identify password for [username]”

auth sufficient pam_permit.so

NOTE!!  If you need to do things like > or |, write a script and send it the command line parameters, adding the full script path to the sudoers file via visudo

Same problem. most of my calls to executeCommandLine now longer work today.

I have not updated OH runtime or bindings, but I keep finding v2.5.10 bindings installed, and my system is still at 2.5.2.