Я уже пытался использовать scrypt для шифрования отдельных файлов, и, похоже, он работает довольно хорошо.
Но что, если я хочу зашифровать все файлы в папке?
Согласно man-странице scrypt - инструмент для шифрования файлов.
Есть ли способ шифровать все файлы в папке?
Можно использовать encfs для шифрования папки:
sudo apt install encfs
Создать необходимые каталоги, один для зашифрованных данных, а другой для доступа к ним: encfs ~/.encrypt ~/visible
Принять запросы, сделанные encfs, затем дать ему пароль по своему вкусу. Теперь поместите файлы для защиты в папку ~/visible. Чтобы скрыть их, выполните: fusermount -u ~/visible
# This will hide all files in there.
Чтобы снова запустить их, выполните: encfs ~/.encrypted ~/visible
# This will ask you for your password so the files
# in ~/visible will be seen and accessed
Источник:
https://help.ubuntu.com/community/FolderEncryption
Используйте Gnome Encfs Manager
Установите его:sudo apt install encfs
Установите его:
Использовать программу Gnome Encfs Manager для использования GUI для достижения того же, что и в методе 1.
for i in /home/$USER/Documents/koko/*; do scrypt enc "$i" "$i-sc"; done
Используя сценарий терминала, вы можете используйте scrypt для достижения этого:
Установите его:
Создайте необходимые каталоги, один для зашифрованных данных, а другой для доступа их:encfs ~/.encrypt ~/visible
Дополнительная информация:
#!/bin/bash
echo "Running script..."
echo " "
echo "Please enter the names of folder to encrypt file contents"
echo "and folder to store the passwords for the files"
echo " "
read -p 'Files location: ' folder
read -p 'Password storage location: ' passwdlocation
read -p 'name of password file: ' mypasswords
echo " "
if [[ -z "$folder" || -z "$passwdlocation" ]];then
echo "Please supply the required folder names"
exit 1
else
if [ -d "/home/$USER/Documents/"$passwdlocation"" ]; then
# If password folder exists ask user if it should be deleted
read -n1 -p "/home/$USER/Documents/"$passwdlocation" exists, delete Y or N?" doit
echo
case "$doit" in
y|Y) rm -R /home/$USER/Documents/"$passwdlocation" && mkdir /home/$USER/Documents/"$passwdlocation";;
n|N) echo "Script terminated by user" && exit 1;;
*) echo
esac
else
mkdir /home/$USER/Documents/"$passwdlocation"
fi
# Is it a directory
if [[ -d "$folder" ]]; then
# Make sure target folder has files in it
if [ ! "$(ls -A "/home/$USER/Documents/"$folder"" 2> /dev/null)" == "" ]; then
# Check if password file already exists
# if it does ask to delete of write to it
if [ "$( ls -A "/home/$USER/Documents/"$passwdlocation"/"$mypasswords".txt" 2> /dev/null)" == "" ]; then
read -n1 -p ""$mypasswords".txt already exists, delete Y or N? " doagain
echo
case "$doagain" in
y|Y) rm -rf "/home/$USER/Documents/"$passwdlocation"/"$mypasswords".txt";;
n|N) echo "file not deleted!";;
*) echo "Operation successful";;
esac
else
fi
for i in "$folder"/*
do
# Create random passwords
filepasswd=$(strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 30 | tr -d '\n';)
scrypt enc -P "$i" "$i-sc" <<< "$filepasswd"
# Add password to password store location
echo -n "$i-sc $filepasswd" >> "/home/$USER/Documents/"$passwdlocation"/"$mypasswords".txt"
echo -e "\n" >> "/home/$USER/Documents/"$passwdlocation"/"$mypasswords".txt"
echo "$i Done"
done
else
echo "The target "$folder" is empty!"
exit 1
fi
else
echo "Invalid arguments .. please supply directory names"
exit 1
fi
fi
echo "Script finished"
Можно использовать encfs для шифрования папки:
sudo apt install encfs
Создать необходимые каталоги, один для зашифрованных данных, а другой для доступа к ним: encfs ~/.encrypt ~/visible
Принять запросы, сделанные encfs, затем дать ему пароль по своему вкусу. Теперь поместите файлы для защиты в папку ~/visible. Чтобы скрыть их, выполните: fusermount -u ~/visible
# This will hide all files in there.
Чтобы снова запустить их, выполните: encfs ~/.encrypted ~/visible
# This will ask you for your password so the files
# in ~/visible will be seen and accessed
Источник:
https://help.ubuntu.com/community/FolderEncryption
Используйте Gnome Encfs Manager
Установите его:sudo apt install encfs
Установите его:
Использовать программу Gnome Encfs Manager для использования GUI для достижения того же, что и в методе 1.
for i in /home/$USER/Documents/koko/*; do scrypt enc "$i" "$i-sc"; done
Используя сценарий терминала, вы можете используйте scrypt для достижения этого:
Установите его:
Создайте необходимые каталоги, один для зашифрованных данных, а другой для доступа их:encfs ~/.encrypt ~/visible
Дополнительная информация:
#!/bin/bash
echo "Running script..."
echo " "
echo "Please enter the names of folder to encrypt file contents"
echo "and folder to store the passwords for the files"
echo " "
read -p 'Files location: ' folder
read -p 'Password storage location: ' passwdlocation
read -p 'name of password file: ' mypasswords
echo " "
if [[ -z "$folder" || -z "$passwdlocation" ]];then
echo "Please supply the required folder names"
exit 1
else
if [ -d "/home/$USER/Documents/"$passwdlocation"" ]; then
# If password folder exists ask user if it should be deleted
read -n1 -p "/home/$USER/Documents/"$passwdlocation" exists, delete Y or N?" doit
echo
case "$doit" in
y|Y) rm -R /home/$USER/Documents/"$passwdlocation" && mkdir /home/$USER/Documents/"$passwdlocation";;
n|N) echo "Script terminated by user" && exit 1;;
*) echo
esac
else
mkdir /home/$USER/Documents/"$passwdlocation"
fi
# Is it a directory
if [[ -d "$folder" ]]; then
# Make sure target folder has files in it
if [ ! "$(ls -A "/home/$USER/Documents/"$folder"" 2> /dev/null)" == "" ]; then
# Check if password file already exists
# if it does ask to delete of write to it
if [ "$( ls -A "/home/$USER/Documents/"$passwdlocation"/"$mypasswords".txt" 2> /dev/null)" == "" ]; then
read -n1 -p ""$mypasswords".txt already exists, delete Y or N? " doagain
echo
case "$doagain" in
y|Y) rm -rf "/home/$USER/Documents/"$passwdlocation"/"$mypasswords".txt";;
n|N) echo "file not deleted!";;
*) echo "Operation successful";;
esac
else
fi
for i in "$folder"/*
do
# Create random passwords
filepasswd=$(strings /dev/urandom | grep -o '[[:alnum:]]' | head -n 30 | tr -d '\n';)
scrypt enc -P "$i" "$i-sc" <<< "$filepasswd"
# Add password to password store location
echo -n "$i-sc $filepasswd" >> "/home/$USER/Documents/"$passwdlocation"/"$mypasswords".txt"
echo -e "\n" >> "/home/$USER/Documents/"$passwdlocation"/"$mypasswords".txt"
echo "$i Done"
done
else
echo "The target "$folder" is empty!"
exit 1
fi
else
echo "Invalid arguments .. please supply directory names"
exit 1
fi
fi
echo "Script finished"