Welcome to the Linux Foundation Forum!

Password in a file..??

abrenar
abrenar Posts: 117

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

Comments

  • wiebelhaus
    wiebelhaus Posts: 5
    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.
  • mfillpot
    mfillpot Posts: 2,177
    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.
  • mfillpot
    mfillpot Posts: 2,177
    lucky you, someone just posted on commandlinefu about the vim password protection. just use vim -x {filename}

    the post is on[url] http://www.commandlinefu.com/commands/view/2100/add-password-protection-to-a-file-your-editing-in-vim.[/url]
  • abrenar
    abrenar Posts: 117
    what happen i am the one last posted what distro? intro. i am automatically log out ????

    :woohoo: :woohoo: :woohoo: :woohoo:
  • mfillpot
    mfillpot Posts: 2,177
    I tested it on slackware and it works, are you using vi or vim?
  • abrenar
    abrenar Posts: 117
    i always using vi, but i try vim -x test but no luck. what is the exact command you run?

    :unsure:
  • mfillpot
    mfillpot Posts: 2,177
    The site has done that to me before.

    I would recommend installing vim ( vi improved) which has the encryption capabilities, vi is still basic and does not have the same functionality.
  • abrenar
    abrenar Posts: 117
    tnx bro. i will try your suggestion.

    tnx a lot
  • mfillpot
    mfillpot Posts: 2,177
    vim -x file

    then it asks for the file password that I want to use.

    I am installing ubuntu 9.04 as a virtual now to test it.
  • wiebelhaus
    wiebelhaus Posts: 5
    mfillpot wrote:
    lucky you, someone just posted on commandlinefu about the vim password protection. just use vim -x {filename}

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

    nice
  • abrenar
    abrenar Posts: 117
    ok done.

    i installed vim :

    sudo apt-get install vim

    then after that:

    vim -x test

    enter encryption keys:



    yehey!!! problem solve.....
  • mfillpot
    mfillpot Posts: 2,177
    I am glad to see that it works for you.

    Rather than encrypting single files I store all of my sensitive files in a single encrypted false-partition so that all files are centrally located and accessible with a single password.

    I would suggest looking into it if you need to protect multiple files.
  • abrenar
    abrenar Posts: 117
    My reason:

    i am doing it because im gonna bind my different files using windows "Google file binding binary mode" , then transfer the file in my ubuntu box then edit it and put a password. if anyone will look my file they will say it is only a regular large file but they do not know that some files are bonded. ^__^

Categories

Upcoming Training