How to encrypt UNIX (solaris AIX Linux) files using vi editior? Protect your UNIX files with password

advertisements

_____________________________________________________________________________________________________________________

The Eucharistic Miracles of the World
vi editor has –x option to encrypt a unix file. You can use this option as a password protection for your UNIX files. The –x option will ask you for a passcode or encryption key which will be used as the key password for the file.
If you encrypt your shell script using this encryption method, it won’t execute. Please find the example below.
How to create a new file with encryption?
$ vi -x welcome
Enter key:<give your key>
This is my test file for encryption

Save the file using Escape :wq

Now try to open the file with vi with normal mode.
$ vi welcome
"welcome" [Incomplete last line] 1 line, 36 characters
!\235^Z\313^DG\3363\371\242\317\327\322\317\235^S\276\240\371-^E\370\332\314\315\362P\360\320\324\3166\303\264\263\364

$ cat welcome
!
$ more welcome
!
$ tail welcome
!

It won’t give the content of the file in any of the commands like cat, more, tail, head etc.
Use vi –x option to read the file.
$ vi -x welcome
Enter key:<Enter your key>
"welcome" 1 line, 36 characters
This is my test file for encryption

How to encrypt an existing file?
Open the file in vi
$ vi normal
"normal" 1 line, 36 characters
This is my test file for encryption

:X
Enter key:<Enter your key>
:wq

Use :X (block letter X) in command mode and this will ask you for encryption key. Now you can enter the key and save the file. The file is encrypted now. Is it useful? J.

_____________________________________________________________________________________________________________________

Website Stats

0 comments:

Post a Comment

Labels

Oracle (629) Script (86) General (77) Unix (47) Blog (23) Technology (19) gadget (6) games (6) Business (3) OCI (3) SQL* Loader (3) Datapump (2)
 

acehints.com Copyright 2011-23 All Rights Reserved | Site Map | Contact | Disclaimer