Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nodejs ssl key permission denied

I am getting this error when trying to access my ssl key and cetificate from my nodejs app:

enter image description here

As you can see, I've added my user to hace permission on the files.. I don't know what else to do?

like image 739
Hristijan Ilieski Avatar asked Oct 02 '16 15:10

Hristijan Ilieski


1 Answers

Ok, I found the solution looking around.

Basically, LetsEncrypt is generating the certificate files in /etc/letsencrypt/live/ and /etc/letsencrypt/archive/. These two folders have permissions 744 ("owner can read, write, and execute; group and users can read"), but it is not enough: you must give permissions to read and execute:

sudo chmod 755 /etc/letsencrypt/live/
sudo chmod 755 /etc/letsencrypt/archive/

This is of course not a good solution for security reasons, but it's the only one I found that works, and surely it's better than running the Node.js server as root!

Source: https://groups.google.com/d/msg/node-red/g8cPmNgGnh0/guWq-8szBAAJ

like image 78
ocramot Avatar answered Oct 04 '22 06:10

ocramot