2

I would like to temporarily store and manipulate sensitive data in vim. I know it keeps cut and copy registers and swap files on the hard drive, though. If you think about this for a moment, you'll see my concern. I would like to open a vim session in which none of the data I enter or manipulate gets written to the hard drive. I have heard of PGP plugins for vim, in which you can write e-mail securely, encrypt it for certain recipients, save it, then encrypt it. Such a plugin must have already solved this problem. But I don't need any of the encryption features. I just need the "secretive" mode.

What will I have to do to accomplish this?

1
  • Besides from the answers below: When you're working with secret data more often, you'd want an encrypted swap anyway, too.
    – ott--
    May 11 '13 at 21:44
2

If you want to be sure, you can always run it in chroot environment on temporary tmpfs filesystem.

6
  • 1
    This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post.
    – Simon
    May 11 '13 at 21:13
  • 2
    @Simon, I do not agree. It is an answer indeed. If you run vim in chroot on tmpfs then problem is solved. vim has no way of writing anything to disk. May 11 '13 at 21:19
  • Then more information on it in the answer would be good. May 11 '13 at 22:00
  • 2
    @Simon, I agree with @Michał –– this is a very good answer. I also happen to believe that it’s at an adequate level of detail. If you need more information, just look up chroot and tmpfs in the manual or a search engine.
    – Scott
    May 11 '13 at 22:43
  • 1
    Note that vim running in a chroot environment will have no way of accessing the secure documents, unless they're copied into that environment. (Your .vimrc and other vim configuration data would have to be copied in there as well) May 13 '13 at 23:18
0

To achieve a limited feeling of security, you could put the lines below in ~/.discreetrc:

set noswapfile
set nobackup
set history=0
set viminfo=
set clipboard=

and launch Vim with:

$ vim -u ~/.discreetrc --noplugin secretfilename

but there are probably other useful options.

-1

How about mapping the write command to something that doesn't write to the disk, e.g.,

:cmap w echo 'disabled!'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.