gle*_*age 6 permissions ubuntu fs node.js
我刚刚遇到fs读取文件的奇怪问题.
我从部署管理器(strongloop strong-pm)运行节点应用程序作为以下用户"strong-pm".
无论我给文件赋予什么权限,我都试图打开节点应用程序,我明白了
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)
Run Code Online (Sandbox Code Playgroud)
我已经尝试了一切:
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
将strong-pm
添加到组中,然后将该组添加到目录中......
仍然没有运气..任何想法?
谢谢!
系统:DigitalOcean上的Ubuntu 14.04 x64
不要在节点内尝试,而是尝试切换到该用户并读取文件:
su strong-pm
cat /root/my_dir/file.txt
Run Code Online (Sandbox Code Playgroud)
如果有效,请确保节点正在使用该用户运行。
| 归档时间: |
|
| 查看次数: |
3641 次 |
| 最近记录: |