Shell Script To Encrypt Any Text File
Posted in File-management » Security
In cryptography, encryption is the process of transforming information (referred to as plaintext) using an algorithm (called cipher) to make it unreadable to anyone except those possessing special knowledge, usually referred to as a key.
Mcrypt is a simple crypting program, a replacement for the old unix crypt(1). When encrypting or decrypting a file, a new file is created with the extension .nc and mode 0600. The new file keeps the modification date of the original. The original file may be deleted by specifying the -u parameter. If no files are specified, the standard input is encrypted to the standard output.
Sample Shell Script Wrapper To Encrypt Any Text File
#!/bin/bash # Write a shell script to encrypt any text file # ------------------------------------------------------------------------- # Copyright (c) 2001 nixCraft project <http://cyberciti.biz/fb/> # This script is licensed under GNU GPL version 2.0 or above # ------------------------------------------------------------------------- # This script is part of nixCraft shell script collection (NSSC) # Visit http://bash.cyberciti.biz/ for more information. # ------------------------------------------------------------------------- file=$1 echo -n "Enter a file name : " read file if [ ! -f $file ] then echo "$file not a file!" exit 1 fi echo -n "Enter a Password : " read password # do encryption using UNIX crypt command # this command will prompt for a password crypt $password < $file > $file.cpy echo "$file.cpy created as encrypted file"
Download - Email this to a friend - Printable version
Is your site working? Monitor Your Web Site 24/7. Get SMS alerts on server downtime! Free 30-day trial including 20 SMS!
Related Other Helpful Shell Scripts:
- Shell Script To Display The Text Entered By The User in Bold
- Backup shell script to backup selected directories and upload securely (gpg) to FTP server
- Bash shell script to reverse text file contain using Shell array
- Shell Script To Translate All Characters In a File To Lowercase
- Shell Script To Delete All Even Numbered Line From a Text File
Discussion on This Shell Script:
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: algorithm, cipher, crypt command, cryptographic software, Cryptography, decryption, encrypted, Encryption, mcrypt, mcrypt command, password crypt, plaintext, symmetric key cryptography, unix crypt ~ Last updated on: September 14, 2008


please how i can install crypt ?
i type crypt and tap he give me cryptsetup!!
can u please help us what is this mean?
thank you
good job