advertisements
_____________________________________________________________________________________________________________________
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.
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.
_____________________________________________________________________________________________________________________
0 comments:
Post a Comment