[SOLVED] Openhab user and directory authorizations

Dear,
I’ve a problem using curl with openhab user:

sudo -u openhab curl -k -H “Content-Type: application/json” -H “Authorization: Bearer KBFz5iq6Wa” --cert /var/lib/openhab2/tmp/samsungac_monolocale.pem --insecure -X PUT -d ‘{“Operation” : {“power” : “On”}}’ https://192.168.1.110:8888/devices/0

curl: (58) could not load PEM client certificate, OpenSSL error error:0200100D:system library:fopen:Permission denied, (no key found, wrong pass phrase, or wrong file format?)

Where can I save my pem file for to have access to them?
I must use openhab user for to have the same conditions present in “executeCOmmandLine” statement inside rules.

Can you help me please?

Fausto

.

It’s not the “where” to save it. It is the permissions on that file. The openhab user doesn’t have permission to read /var/lib/openhab2/tmp/samsungac_monolocale.pem.

https://www.pluralsight.com/blog/it-ops/linux-file-permissions

perfect!!!
The problem now is solved!
Thanks

Thanks man. I was facing the same issue and I changed the file permissions. This solves the problem. For those who need to check how to change permissions, please check out.

Make sure you run the chmod command with sudo rights, i.e $sudo chmod u=rwx,g=rwx,o=rwx [file_name]