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?


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


You can try su -i or sudu su or sudo -s and then cd {DIR}.