I've come across a *.apk where permissions are needed to be set to the *.db file. But I don't know what's it meaning. Help?
It's difficult to tell for certain without a bit more context, but it sounds like the instructions are attempting to convey the Unix filesystem permissions to set on the database.
Since Android at its core runs on the Linux kernel, its filesystem maintains the same permission and access rules as any typical Unix system does. In general, there are three relevant access modes for a file:
- The owner: This is the specific user that owns a file/folder. Generally it defaults to whatever user created it. Note that even on Android, which generally presents a single-user interface (excepting v4.2) there are still multiple user accounts on the device. For example, each application runs under its own user ID.
- The group: This is the Unix group that is marked as the owner of the file. The user that owns the file may or may not be a member of this group. In cases where the owner is not in the group the owner permissions will take precedence.
- Other: Everyone else who is not either a) the owner of the file or b) in the group that owns the file.
Because of this, simplified Unix filesystem permissions are generally expressed as triplets (I'm ignoring here other flags such as the setuid bit) in order of precedence: user/group/other. Often these will be numerical since Unix uses bitmasks under the hood, where:
- Execute has a value of 1
- Write has a value of 2
- Read has a value of 4
Permissions are thus combined by adding the bitmask values together - to give read and write (but not execute) permission to the desired target, for example, you would want the value to be 6. Putting this together, a file with a permission of 755 would be:
7 -> Owner can read, write or execute 5 -> Group members can read or execute 5 -> Everyone else (other) can read or execute
Putting this all together in the context of your question implies (to me) that the instructions are thus telling you to give the owner of the .db file read/write permission, the group read/write permission and other no permissions at all. I observe this by splitting up the instructions at the slash delimiter in the text.
This would be equivalent to setting the filemode to
660 using the
chmod command (likely you would want
chmod 0660 /path/to/file.db), but can also be done using any file explorer that supports it. My personal favorite is ES File Explorer, which will give you a grid of checkboxes if you long press on a file and select "Properties". Simply check the appropriate boxes for each target (owner, group, and other).
Izzy summed up what this would mean from a functional standpoint rather well:
It would mean the app itself (=owner) has full access to the database, as has the group (probably for addons/plugins?). All other apps have no access at all (as it should be, keyword "Sandbox")