How do I make ecryptfs automatically use my key?

833 Views Asked by At

I would like to programmatically mount a volume from my code and I am using the mount system call for that. I have ecryptfs installed. To manually mount a volume, I can use mount -t ecryptfs /src /dst and this will cause ecryptfs to interactively ask me for the information.

I would like it to instead automatically use my key file that I point it at and proceed.

1

There are 1 best solutions below

0
nilesh deshmukh On

You can use the echo command to take password automatically while mounting with eCryptFs,

Example:

echo | mount -t ecryptfs -o ecryptfs_cipher=aes,ecryptfs_key_bytes=32,ecryptfs_passthrough=no,ecryptfs_enable_filename_crypto=yes,no_sig_cache,key=passphrase:passwd="12345" /data/config/ /data/config/

If you want use it in your code, then form the above string by extracting password from your file and use system API (system("");) to mount the partition with eCryptFS.