“permission denied” error despite having all needed file system permissions

瘦欲@ 提交于 2019-12-12 03:03:46

问题


I'm on an android, using adb shell to troubleshoot an issue which my app has with the file system. I'm encountering a permissions error when using tinyalsa, so I wish to investigate the directories involved.

cannot open device '/dev/snd/pcmC1D0c': Permission denied

If I su and then stat each item in the path, the shell tells me the following permissions:

/         (755/drwxr-xr-x)
/dev/     (755/drwxr-xr-x)
/dev/snd/ (755/drwxr-xr-x)

If I try to stat /dev/snd without su, however, I get Permission denied.

Why would this be? I've even tried su -c 'chmod -R a+rx /dev/snd', but that makes no difference.


回答1:


I don't know much in this area, but it appears that SELinux is interfering. If you disable it:

# In a "su" adb shell
printf 0 > /sys/fs/selinux/enforce

...you can experience the permissions that you see when you run stat as root.

This may not be the optimal solution, but it will allow you to perform the actions needed. I recommend reading up on SELinux if you are developing for anything but a very exclusive user base.



来源:https://stackoverflow.com/questions/40410190/permission-denied-error-despite-having-all-needed-file-system-permissions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!