[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

encfs systemd startup script - how to ask for a password?



Hello!

I have a sysvinit script which reads something like this (boring bits
such as error checking and log messages omitted):

#! /bin/sh
### BEGIN INIT INFO
# Provides:          mountencfs
# Required-Start:    mountall
# Required-Stop:
# Default-Start:     S
# Default-Stop:
# X-Interactive: true
# Short-Description: Mount encfs filesystems.
# Description:
### END INIT INFO

[...]
do_start(){
  edir=/home/.encfs/jdg
  pdir=/home/jdg

  mkdir $pdir
  encfs --public "$edir" "$pdir"
}

case "$1" in
  start|"")
	do_start
	;;
esac


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?

Thanks!

   Julian


Reply to: