encfs systemd startup script - how to ask for a password?
I have a sysvinit script which reads something like this (boring bits
such as error checking and log messages omitted):
### BEGIN INIT INFO
# Provides: mountencfs
# Required-Start: mountall
# Default-Start: S
# X-Interactive: true
# Short-Description: Mount encfs filesystems.
### END INIT INFO
encfs --public "$edir" "$pdir"
case "$1" in
Under sysvinit, this is fine: the Debian X-Interactive header means
that the script stops, prompts for the encfs password, and then
continues. (My encfs password is distinct from my login password for
various reasons, and I do need to mount the directory at boot time.)
I am considering converting to systemd, but I cannot figure out how to
replicate this behaviour. I have tried replacing the encfs call with:
encfs --extpass="/bin/systemd-ask-password --timeout=0 --no-tty 'Encfs
password for $pdir:'" --public "$edir" "$pdir"
(all on one line), with the unit file specifying that it is wanted by
multi-user.target. systemd-ask-password does run, as I can ascertain
by logging in as root and running ps. But I'm not prompted for a
password at all, unless I then run systemd-ask-password (or something
like that) as root.
What am I doing wrong, and what can I do about it?