Welcome to Vifm Q&A, where you can ask questions about using Vifm. Registration is optional, anonymous posts are moderated. E-mail and GitHub logins are enabled.
0 votes
in vifm by

as title, how can I achieve that? otherwise it gives me error when trying to mount an archive password protected

1 Answer

0 votes
by

You can specify %FOREGROUND in your filetype command to allow FUSE mounter to ask for password.

by

thank you for the suggestion but vifm still gives me Failed to mount file: /root/test.rar and console outputs rar2fs: cannot open '/root/test.rar': ERAR_MISSING_PASSWORD

My filetype command is filetype {*.rar},<application/x-rar> FUSE_MOUNT|chown john %DESTINATION_DIR && su -c 'rar2fs %SOURCE_FILE %DESTINATION_DIR %FOREGROUND -o allow_other' john

and works perfectly with clear rar archives

by

Check that running:

su -c 'rar2fs your-archive /tmp/something -o allow_other' john

Works. man su says about -c:

The executed command will have no controlling terminal. This option cannot be used to execute interactive programs which need a controlling TTY.

And that might be the reason why it doesn't work.

by

unfortunately that's only a part of the problem, it goes more deep than that

rar2fs is non-interactive, passwords that are required to decrypt
encrypted archives should be stored in a file with the same name as
the main archive/volume file but with a .pwd extension. It may also be
prefixed with a dot '.'

could I use some other utility to achieve this?

by

This works in shell, and gives a password prompt:

archivemount -o password test.rar /tmp/test

but there are 2 problems:

1) it prompts for password even with clear archives
2) the prompt do not show up at all in vifm, even with %FOREGROUND:

FUSE_MOUNT|archivemount -o password %SOURCE_FILE %DESTINATION_DIR %FOREGROUND
by

There are also at least https://github.com/google/fuse-archive and https://github.com/andrew-grechkin/fuse3-p7zip, but both seem to be non-interactive as well.

1) it prompts for password even with clear archives

If there is some way to detect password protection, you could write a script to pass -o password only in those cases.

2) the prompt do not show up at all in vifm, even with %FOREGROUND:

Append 2>&1. It seems to print the prompt on stderr.

by

Appending that redir worked but now it seems to mount an empty archive. I should troubleshoot that too but the overhead is becoming too big, I think I will stick managing those kind of occurrence in the shell. Thank you anyway, lovely support =)

If you would like to make a bug report or feature request consider using GitHub, SourceForge or e-mail. Posting such things here is acceptable, but this is not a perfect place for them.
...