If a rootdir is mounted by encfs to a mount point, I can see the mount point by "mount" command or from the /proc/mounts. However, if I can get the mount point, but I don't know which rootdir I have mounted, how do I locate that encrypted directory?


You can check the running encfs commands to match mount points with underlying directories. Using Linux's ps syntax:

ps ww -C encfs -o cmd=

Using POSIX ps syntax:

COLUMNS=999999999 ps -o args= | grep -E '^([^ ]*/)?encfs'

This is somewhat awkward to parse automatically. If you keep your directory names free of whitespace and put options before operands, you can use (with Linux syntax):

ps ww -C encfs -o cmd= | awk -v m='/path/to/mount/point' '$NF == m {print $(NF-1)}'

Your Answer

