permission denied, open 'welcome.js'
-
No matter which template I set the email configuration to, that page will show up as an error in the log.
2021-08-19T18:06:45.111Z [4567/79936] - error: [emailer] Failed to build custom email templates Error: EACCES: permission denied, open '/opt/nodebb/build/public/templates/emails/welcome.js'
I looked at the file permissions and they are all fine. If I change the template to banned for example, then the error will point to the banned.js file.
My settings are using an external mail server (one on our own network), Custom service selected since there is no other option such as 'my own' and then the name of the external server, port and security. Mail is getting out as it should be but seeing the above errors, I wanted to ask about it.
BTW, for some strange reason, it also auto fills in the username/password which I don't even need but no way to remove.
-
chown -R
andchmod -R
the files in your NodeBB directory. Odds are you ran something with sudo and that messed things up. -
@pitaj Hi,
The permissions are all owned by root since nginx is being used as a proxy. The notice above only shows for which ever page I pick. If I pick the banned template, the error is the banned.js.
The permissions are;
-rw-r--r-- 1 root root 13314 Aug 19 10:53 banned.js -rw-r--r-- 1 root root 10509 Aug 19 10:53 banned.tpl -rw-r--r-- 1 root root 33997 Aug 19 10:53 digest.js -rw-r--r-- 1 root root 21667 Aug 19 10:53 digest.tpl -rw-r--r-- 1 root root 13708 Aug 19 10:53 invitation.js -rw-r--r-- 1 root root 11083 Aug 19 10:53 invitation.tpl -rw-r--r-- 1 root root 13985 Aug 19 10:53 notification.js -rw-r--r-- 1 root root 11128 Aug 19 10:53 notification.tpl drwxr-xr-x 2 root root 129 Aug 19 10:53 partials -rw-r--r-- 1 root root 13058 Aug 19 10:53 registration_accepted.js -rw-r--r-- 1 root root 10540 Aug 19 10:53 registration_accepted.tpl -rw-r--r-- 1 root root 13256 Aug 19 10:53 reset.js -rw-r--r-- 1 root root 13507 Aug 19 10:53 reset_notify.js -rw-r--r-- 1 root root 10866 Aug 19 10:53 reset_notify.tpl -rw-r--r-- 1 root root 10840 Aug 19 10:53 reset.tpl -rw-r--r-- 1 root root 12951 Aug 19 10:53 test.js -rw-r--r-- 1 root root 10508 Aug 19 10:53 test.tpl -rw-r--r-- 1 root root 13269 Aug 19 10:53 verify_email.js -rw-r--r-- 1 root root 10853 Aug 19 10:53 verify_email.tpl -rw-r--r-- 1 root root 12483 Aug 19 10:53 welcome.js -rw-r--r-- 1 root root 10064 Aug 19 10:53 welcome.tpl
-
@nodeham nginx has nothing to do with what user your NodeBB files should be owned by. Are you running NodeBB as root as well? Your NodeBB files should be owned by the user running nodebb. At the most, nginx should have read permission on those files (which it will since it's root) if you want to use it to serve static assets.
-
-
So nginx runs as nginx user of course but the nodebb files were all changed to be owned by user nodebb when installing everything.
Somehow, the entire nodebb/build/public/templates/emails/
directory became owned by root at some point and that would not have been done by me so an update, a plugin, something else changed that entire directory.Changing the owner for that sub-dir took the problem away.
The next odd thing I see is this.
I changed the template page to the welcome page to test.
I then hit save then I clicked on send test.
The received email was the banned one.While it showed the welcome page being set, when I hit refresh, it always goes back to the banned template page.
-
@nodeham you probably ran nodebb with sudo at one point. Easy mistake to make.
I changed the template page to the welcome page to test.
I then hit save then I clicked on send test.
The received email was the banned one.While it showed the welcome page being set, when I hit refresh, it always goes back to the banned template page.
You don't need to save before sending the test email. You just select what kind to send and then click send test. The select isn't saved.