-
Notifications
You must be signed in to change notification settings - Fork 4
/
decrypt_backups.sh
executable file
·54 lines (44 loc) · 1.58 KB
/
decrypt_backups.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
#=================================================
# INSTALL DEPENDENCIES
#=================================================
sudo apt-get update
sudo apt-get install encfs ccrypt
#=================================================
# ASK FOR THE BACKUP DIRECTORY
#=================================================
while true
do
echo ""
echo "Please enter the absolute path of the encrypted backup you're willing to decrypt"
echo -n ": "
read encrypted_backup_dir
if [ ${encrypted_backup_dir:0:1} == '/' ]
then
if [ -e "$encrypted_backup_dir" ]
then
break
else
echo "This directory does not exist."
fi
else
echo "This path is not absolute. Please enter an absolute path."
fi
done
echo ""
#=================================================
# DECRYPT .ENCFS6.XML
#=================================================
echo "Please enter the password to decrypt encfs file"
ccrypt --decrypt "$encrypted_backup_dir/.encfs6.xml.encrypted.cpt"
mv "$encrypted_backup_dir/.encfs6.xml.encrypted" "$encrypted_backup_dir/.encfs6.xml"
#=================================================
# DECRYPT THE BACKUP DIRECTORY
#=================================================
echo ""
mkdir -p "${encrypted_backup_dir}_decrypted"
echo "Please enter the password to decrypt your backups (same as previous)"
encfs --idle=5 "$encrypted_backup_dir" "${encrypted_backup_dir}_decrypted"
echo ""
echo "Your backup are available in clear at ${encrypted_backup_dir}_decrypted"
echo "In will be unmount 5 minutes after you stop using it."