Linux.com

Password in a file..??

Link to this post 14 May 09

Good day !

I would like to know if it is possible to protect a file with a password, for example before you can less, or more to a file it will ask you a password before it will give access to the file. tnx

Link to this post 14 May 09

Not the file per say but you can encrypt a folder with True crypt. Is that what your looking to do? Also Nautilus has encryption functionalities.

Link to this post 14 May 09

You can use dd to create a fake partition and use cryptsetup to encrypt the false partition. If you store files within the partition then they can only be accessed after you successfully mount the partition and use the correct password.

Link to this post 14 May 09

all i want is everytime i access a certain file it will ask me a password for example i want to vi a file test1.

vi test1 --> after this command the system will ask me a password.
the file is a normal file not a directoy.

if it is possible in linux? if not in ubuntu any distro?

Link to this post 14 May 09

lucky you, someone just posted on commandlinefu about the vim password protection. just use vim -x {filename}

the post is on http://www.commandlinefu.com/commands/view/2100/add-password-protection-to-a-file-your-editing-in-vim.

Link to this post 14 May 09

what distro? i try it to my ubuntu intrepid but there is no options -x ? :(

Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board