cli icon indicating copy to clipboard operation
cli copied to clipboard

set FUSE subtype and fsname by default

Open mhogomchungu opened this issue 5 years ago • 7 comments

Currently, a mounted cryptomator volume shows up in "/proc/self/mountinfo" in linux as follows:

41 33 0:34 / /home/_/cryptomator rw,nosuid,nodev,relatime - fuse.fusefs-1001772408 fusefs-1001772408 rw,user_id=500,group_id=500

Notice that there is no way of knowing if this entry belongs to cryptomator because "fuse.fusefs-1001772408" is not very meaningful because the numbers are randomly generated i think from here[1]

With this patch, the above line shows up as below

49 33 0:42 / /home/ink/bbb rw,nosuid,nodev,relatime - fuse.cryptomator cryptomator@/home/ink/.vaults/cryptomator rw,user_id=500,group_id=500

The above line has the following improvements :-

  1. The path to the vault is displayed.
  2. The file system entry has the correct entry of "fuse.cryptomator".
  3. The path to the vault starts with "cryptomator@". This is the standard way of identifying FUSE mounts that do not set the file system type.

The last two makes it easy to identify cryptomator volumes and are necessary for identification by other tools like file managers and desktop environments.

[1] https://github.com/SerCeMan/jnr-fuse/blob/c5d071af150a191c72b6ed91fd5865ffa1853d4a/src/main/java/ru/serce/jnrfuse/AbstractFuseFS.java#L315

mhogomchungu avatar Nov 08 '20 21:11 mhogomchungu

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Nov 08 '20 21:11 CLAassistant

The second commit leaves the defaults as they are and it allows users to set FUSE fsname and subtype if they want to and an ideal command that uses them looks like below

cryptomator-cli --vault blabla=/path/to/cryptomator -fusemount blabla=/path/to/mountpath -fsname blabla=cryptomator@/path/to/cryptomator -subtype blabla=cryptomator

mhogomchungu avatar Nov 09 '20 00:11 mhogomchungu

Thank you for your PR! I must admit, I think it would be much easier if we'd introduce a mountFlags option and not options for each mount flag (because the list could become very long then). What do you think?

tobihagemann avatar Nov 19 '20 12:11 tobihagemann

That makes sense and the latest code has the option.

Example is below where it sets fsname,subtype and allow_other.

With an option like fsname that takes an argument, the option is supposed to be in a format of fsname=cryptomator but i went with fsname cryptomator because the command line parser seems to be confused when it sees the "=" sign.

java -jar cryptomator-cli.jar --vault aaa=cipherPath -fusemount aaa=mountPath -mountFlags aaa=fsname cryptomator,subtype cryptomater,allow_other

mhogomchungu avatar Nov 19 '20 14:11 mhogomchungu

Out of curiosity, does the command-line parser handle quotes better? Would something like this be possible (without making things more complex)?

-mountFlags aaa="-ofsname=cryptomator -osubtype=cryptomater -oallow_other"

And then not even adding them to the default flags but using them "as is".

tobihagemann avatar Nov 20 '20 00:11 tobihagemann

Out of curiosity, does the command-line parser handle quotes better? Would something like this be possible (without making things more complex)?

No, it does not, it stops when it sees the "=" sign.

java -jar cryptomator-cli.jar --vault aaa=cipherPath -fusemount aaa=aaa -mountFlags aaa="-ofsname=cryptomator -osubtype=cryptomater -oallow_other"
06:54:30.399 [main] INFO  org.cryptomator.cli.CryptomatorCli - Unlocking vault "aaa" located at /home/ink/.vaults/cryptomator
06:54:30.411 [main] INFO  o.c.c.p.PasswordFromStdInputStrategy - Vault 'aaa' password from standard input.
Enter password for vault 'aaa': 

fuse: unknown option `-ofsname'
06:54:34.679 [main] ERROR o.cryptomator.cli.frontend.FuseMount - Can't mount: aaa, error: ru.serce.jnrfuse.FuseException: Unable to mount FS
06:54:34.683 [main] INFO  org.cryptomator.cli.CryptomatorCli - Press Ctrl+C to terminate.

mhogomchungu avatar Nov 20 '20 03:11 mhogomchungu

"=" character appears to be an illegal character and any option including cipher path and mount point path that has it will be broken because it will get truncated at the location of the character.

mhogomchungu avatar Nov 20 '20 07:11 mhogomchungu