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

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

$ 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

Enter key:<Enter your key>

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.
DBA Tips Data Pump Reference


Post a Comment


dba topics. Copyright 2011-17 All Rights Reserved | Site Map | Contact | Disclaimer | Google