非root设备上的Android用户空间文件系统驱动程序?
我可以编写一个可以通过标准可用实用程序在非 root 工厂设备上运行的自定义用户空间文件系统吗?
我知道 fuse-android 的存在,但据我所知,它需要有 root 权限的设备。如果情况并非如此,请纠正我。
我试图实现的目标是创建一个实际上挂载到文件的“假”FS。
Can I write a custom userspace file system that can be run on non-rooted factory devices through the standard available utilities?
I am aware of the existence of fuse-android, however as far as I have understood, it requires a rooted device. If that is not the case, please do correct me.
The goal I am trying to achieve is create a 'fake' FS that actually is mounted to a file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不久前我也有同样的需求,但我不得不承认这根本不可能(大部分)。为android构建libfuse应该不是问题,Java包装器也没有问题。
真正的问题是,我见过的大多数系统都不是使用熔断器支持内置构建的,也不提供可以加载的模块(这需要 root,但无论如何)。
您可以通过读取 /proc/filesystems 轻松查明熔断器是否启用。它应该列出保险丝,否则你将需要 root。但很可能大多数 Android 设备都是在没有熔丝支持的情况下构建的。
我的其他想法是使用另一个文件系统来“伪造”诸如保险丝之类的东西。这可以通过 nfs 或其他一些网络文件系统实现,您可以在其中自行实现服务器。这可以让你写一个假保险丝,但我认为这不值得。
编辑:
即使许多设备具有熔丝支持内置机会很高,它们也不会让您以用户身份安装它,您将需要 root 访问权限,因为您的应用程序没有安装熔丝文件系统的权限。
I had the same need some time ago and came to the point where I had to admit that's not possible at all (mostly). It shouldn't be a problem to build libfuse for android, also the Java wrapper is no problem.
The real problem is that most of the systems I have seen aren't build with fuse support buildin nor do they provide modules which may be loaded (which would require root, but anyway).
You can easily find out if fuse is enabled by reading /proc/filesystems. It should list fuse, otherwise you will need root. But it's very likely that most android devices are build without fuse support.
My other ideas were to use another filesystem to "fake" something like fuse. This may be possible with nfs or some other network filesystem where you can implement the server by yourself. This whould enable you to write a fake fuse but I don't think it's worth it.
Edit:
And even if many devices would have fuse support buildin chances are high they wouldn't let you mount it as a user, you would need root access as your app wouldn't have the privileges to mount fuse filesystems.
卢明格的想法几乎是正确的。以下是我在 Galaxy S3(Verizon 上)上发现的内容:
/proc/filesystems 中确实存在适当的熔丝内容。所以有东西一定在使用它,很可能是系统。但是,当我尝试执行“fusermount”时,我收到“无法执行 - 权限被拒绝”。
所以看起来所有的 FUSE 东西都在那里,但我不知道我是否可以在不 root 设备的情况下直接使用它(dropbox?sshfs?)。
Luminger almost has the right idea. Here's what I found on my Galaxy S3 (on Verizon):
The appropriate fuse stuff does exist in /proc/filesystems. So something must be using it, quite possibly system. However, when I attempt to execute 'fusermount', I get "Cannot execute -- Permission denied."
So it looks like all the FUSE stuff is there, but I've got no idea whether I could actually use it directly (dropbox? sshfs?) without rooting the device.
这取决于您的实施。在我看来,您想要一个代表完整用户空间文件系统的物理文件。也许类似于已安装的 .iso。如果是这种情况,我想不出任何需要 root 的原因:您只需在 /sdcard/ 等位置创建/安装该文件,然后在其上“安装”您的文件系统即可。
也就是说,如果您希望从您无法控制的其他应用程序访问所述文件系统,则需要 root 权限,否则您的应用程序将在 Android 沙箱中运行。
It depends on your implementation. What it sounds like to me is you want to have a physical file(s) that represent a full user space file system. Perhaps similar to a mounted .iso. If this is the case, I cannot think of any reason for needing root: You simply create/install the file somewhere such as /sdcard/ and "mount" your file system on top of it.
That said, if you want said file system to be accessible from other applications that you do not control, you'll need root as your application will be running in a Android sandbox otherwise.