Ajouter 'coffre'

This commit is contained in:
Xavier 2023-05-04 10:57:36 +02:00
parent c5ef9442cd
commit 615b67ef69

48
coffre Normal file
View File

@ -0,0 +1,48 @@
#!/bin/sh
clear
sudo modprobe fuse
rep="/home/xavier/"
rep1=$rep".encrypted"
rep2=$rep"decrypted"
file="/media/xavier/SECURE/passphrase.bin"
#Close Coffre fort numérique
if [ "$1" = "close" ] && [ ! -f "$rep2" ]
then
fusermount -u "$rep2"
echo "Closed"
exit 0
fi
#Installation du coffre fort numérique
if [ "$1" = "install" ] && [ ! -f "$rep1" ]
then
mkdir "$rep1" "$rep2"
sudo apt install encfs
echo "Usage coffre open or close"
exit 0
fi
#Aide
if [ "$1" = "" ]
then
echo "Usage: $0 |open|close|install"
exit 0
fi
#Open Coffre fort numérique
if [ "$1" = "open" ] && [ ! -f "$rep2" ]
then
echo "Trying to get the key from USB keychain ..."
if [ -f "$file" ]
then
base64 -w 0 "$file" | encfs -S $rep1 $rep2
else
echo "FAILED to find suitable USB keychain ..."
exit 1
fi
fi
exit 0