File Password Protection
A > How do I password protect / encrypt a file within Linux using OpenSSL ?
The file we will encrypt will be the file secretfile.txt.As you can see it is just a plain text file.
Encrypt File
Use the openssl comand to encrypt your file and then test the new file is fully encrypted.
$ openssl aes-256-cbc -salt -in secretfile.txt -out secretfile.txt.aes
enter aes-256-cbc encryption password:
Verifying – enter aes-256-cbc encryption password:
$ cat secretfile.txt.aes
binary data
Decrypt File
Decrypt the file and then confirm the decypted file is readable.
$ openssl aes-256-cbc -d -salt -in secretfile.txt.aes -out secretfile.txt
enter aes-256-cbc decryption password:
$ cat secretfile.txt
This is a secret file that we do not want anyone to read.
B > How do I password protect / encrypt a file within Linux using Mcrypt ?
Encrypt File
Use the mcrypt comand to encrypt your file and then test the new file is fully encrypted.
$ mcrypt secretfile.txt
Output:
Enter the passphrase (maximum of 512 characters)
Please use a combination of upper and lower case letters and numbers.
Enter passphrase:
Enter passphrase:
A new file is created with the extension .nc
$ ls secretfile.txt.nc
Decrypt File
Decrypt the file and then confirm the decypted file is readable.
$ mcrypt -d secretfile.txt.nc
Output:
Enter passphrase:
File secretfile.txt.nc was decrypted.
C > How do I password protect / encrypt a file within Linux using GPG ?
Encrypt File
Use the gpg comand to encrypt your file and then test the new file is fully encrypted.
$ gpg -c secretfile.txt
Output:
Enter passphrase:
Repeat passphrase:
This will create a secretfile.txt.gpg file.
Decrypt File
Decrypt the file and then confirm the decypted file is readable.
$ gpg secretfile.txt.gpg
Decrypt file and write output to file
$ gpg secretfile.txt.gpg -o somefile.txt
Easier method is to create a file using vim with the -x flag
vim -x
-
Recent
- Linux disk cache
- redhat/centos build kernel rpm
- KVM on centos5
- File Password Protection
- Building modules for rhel5 kernel
- Open SSL help
- Extracting certificates from java keystore to use in apache.conf
- What is bonding?
- Xen rescue paravirtualization
- flash player on firefox 64 bite
- Samba4 HOWTO + Fedora
- MRTG HowTo
-
Links
-
Archives
- July 2010 (3)
- March 2010 (1)
- January 2010 (5)
- December 2009 (1)
- April 2009 (1)
- January 2009 (1)
- November 2008 (12)
-
Categories
-
RSS
Entries RSS
Comments RSS