I've just run into a strange problem with fs reading a file.
I have node application run from a deployment manager (strongloop strong-pm) as the following user "strong-pm".
No matter what permissions I give to the file I'm trying to open throug the node app, I get
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
worker:1 Error: EACCES, permission denied '/root/my_dir/file.txt'
at Object.fs.openSync (fs.js:432:18)
at Object.fs.readFileSync (fs.js:286:15)
I've tried everything:sudo chown -R strong-pm:strong-pm /root/my_dir
sudo chmod -R 777 /root/my_dir
sudo chmod 777 /root/my_dir/file.txt
adding the strong-pm to a group
then adding that group to the directory...
Still no luck.. any ideas?
Thanks!
System: Ubuntu 14.04 x64 on DigitalOcean
Rather than trying it inside node, try to switch to that user and read the file:
su strong-pm
cat /root/my_dir/file.txt
If that works, make sure node is running using that user.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With