Crypter des fichiers sous Ubuntu 11.04

Avec l’explosion du « cloud » et plus précisément du stockage de données en ligne, il devient intéressant (obligatoire?) de crypter  ses données en ligne.

Avec Ubuntu cette opération est des plus simple.

Pour commencer il faut installer le paquet CCRYPT présent dans la logithèque Ubuntu.

Ceci fait, le cryptage peut se faire en ligne de commande comme suit: ouvrir un terminal dans le répertoire qui contient le fichier à crypter et taper la commande suivante pour crypter:

ccencrypt nom_du_fichier

Il vous faudra taper une phrase « mot de passe » dont la longueur garantira la qualité du cryptage… Pensez à la retenir….

Et pour décrypter:

ccdecrypt nom_du_fichier

Il vous faudra, cette fois ci taper la phrase secrète utilisée pour crypter le fichier!

Pour les réfractaires à la ligne de commande il est possible d’avoir ces même fonctions dans le clic droit, par l’intermédiaire d’un script.

Pour commencer ouvrez le répertoire des scripts: « clic droit/scripts/ouvrir le dossier scripts »

Dans le répertoire fraîchement ouvert: « clic droit/créer un document/fichier vierge »

Puis copier/coller ceci dans le fichier vide:

#!/bin/bash
#
# This script decrypts file(s) or directories encrypted with ccrypt
#
# Distributed under the terms of GNU GPL version 2 or later
#
# From About Info:
# All executable files in this folder will appear in the Scripts menu.
# Choosing a script from the menu will run that script.
#
# When executed from a local folder, scripts will be passed the selected
# file names. When executed from a remote folder (e.g. a folder showing
# web or ftp content), scripts will be passed no parameters.
#
# In all cases, the following environment variables will be set by
# Nautilus, which the scripts may use:
#
# NAUTILUS_SCRIPT_SELECTED_FILE_PATHS:
# newline-delimited paths for selected files (only if local)
#
# NAUTILUS_SCRIPT_SELECTED_URIS:
# newline-delimited URIs for selected files
#
# NAUTILUS_SCRIPT_CURRENT_URI:
# URI for current location
#
# NAUTILUS_SCRIPT_WINDOW_GEOMETRY: position and size of current window
#
#
# Convert environment variable contents from newline-delimited to
# quota-space-delimited to allow for spaces on file names.
# Thanks for the solution to: http://g-scripts.sourceforge.net/
#
# We put ccrypt full path in environment variable here to avoid
# problems with variables substitution when creatign files
CCRYPT_PATH=/usr/bin/ccrypt
#
quoted=$(echo -e "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | awk 'BEGIN { FS = "\n" } { printf "\"%s\" ", $1 }' | sed -e s#\"\"##)
#
# Call Gnome Terminal to execute ccrypt
gnome-terminal -t "Decrypting File(s)" --hide-menubar -e "$CCRYPT_PATH -d -s -v -t -r -P 'Enter File(s) Decryption Key: ' $quoted"

et le script chiffrer

#!/bin/bash
#
# This script encrypts file(s) or directories with ccrypt
#
# Distributed under the terms of GNU GPL version 2 or later
#
# From About Info:
# All executable files in this folder will appear in the Scripts menu.
# Choosing a script from the menu will run that script.
#
# When executed from a local folder, scripts will be passed the selected
# file names. When executed from a remote folder (e.g. a folder showing
# web or ftp content), scripts will be passed no parameters.
#
# In all cases, the following environment variables will be set by
# Nautilus, which the scripts may use:
#
# NAUTILUS_SCRIPT_SELECTED_FILE_PATHS:
# newline-delimited paths for selected files (only if local)
#
# NAUTILUS_SCRIPT_SELECTED_URIS:
# newline-delimited URIs for selected files
#
# NAUTILUS_SCRIPT_CURRENT_URI:
# URI for current location
#
# NAUTILUS_SCRIPT_WINDOW_GEOMETRY: position and size of current window
#
#
# Convert environment variable contents from newline-delimited to
# quota-space-delimited to allow for spaces on file names.
# Thanks for the solution to: http://g-scripts.sourceforge.net/
#
# We put ccrypt full path in environment variable here to avoid
# problems with variables substitution when creatign files
CCRYPT_PATH=/usr/bin/ccrypt
#
quoted=$(echo -e "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | awk 'BEGIN { FS = "\n" } { printf "\"%s\" ", $1 }' | sed -e s#\"\"##)
#
# Call Gnome Terminal to execute ccrypt
gnome-terminal -t "Encrypting File(s)" --hide-menubar -e "$CCRYPT_PATH -e -s -v -b -r -P 'Enter File(s) Encryption Key: ' $quoted"
Merci à roger64 pour le script!

Enregistrez le fichier, et nommez le cryptage, par exemple. Faites un clic droit sur ce fichier, puis « propriétés« , onglet « permissions » et cochez « Autoriser l’éxecution comme un programme« .

Déconnectez vous, puis reconnectez vous, et vous avez désormais cette fonctionnalité dans le clic droit/scripts.

Cette entrée a été publiée dans Non classé. Vous pouvez la mettre en favoris avec ce permalien.

Les commentaires sont fermés.