1834449 Members
1916 Online
110067 Solutions
New Discussion

vi -x?

 
SOLVED
Go to solution
joe_91
Super Advisor

vi -x?

Hi All:

I want to create some file which i do not want others to read so vi -x filename with the key. Question would be how do i execute it?

Thanks
Joe.
5 REPLIES 5
James R. Ferguson
Acclaimed Contributor

Re: vi -x?

Hi Joe:

If I understand your question correctly, simply take a look at the man pages for 'crypt'. There is an example there.

Regards!

...JRF...
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: vi -x?

When you invoke vi with the -x option, you are first prompted for a 'key' e.g. 'topsecret'; you then edit/create a textfile just as you normally would and save it.

If someone now tries to vi or cat the file, it is gibberish.

To edit/view the file, you again invoke vi -x; when prompted for the key, enter the same key that you originally used.

-----------------------------------------

Now, if your question is: "I created a shell script using vi -x. How can I then execute it?". The answer is that you can't. Your options are 1) write in in a programming language like C or C++. 2) Get a copy of ShellLock from these guys: http://www.cactus.com/. 3) Use Perl with the Filter module, in that case everything after the use Filter; statement is encrypted.
If it ain't broke, I can fix that.
MANOJ SRIVASTAVA
Honored Contributor

Re: vi -x?

Hi Joe

vi -x < file name>
enter Key : enter a ascill string like abc ( say a passwd )
modify the file
save it, and exit.

now if you cat the filenaem it will show the dump non ascii characters to view the same file back you can vi -x filename again and then enter the asccii string which you entered before.


Manoj Srivastava
joe_91
Super Advisor

Re: vi -x?

Thanks much. I am sorry for not making that clear. Actually i wanted to execute the script. Seems i can't do it now. Thanks anyway.

Joe.
Joseph C. Denman
Honored Contributor

Re: vi -x?

How about???

`crypt key < encrypted.file`



...jcd...
If I had only read the instructions first??