# Encrypting my passwords in a text file

## grant123

I'd like to store my passwords in a text file and then encrypt that text file so that it can be decrypted with only a single password.  How can I do this?

----------

## szatox

You can encrypt it with GPG.

Or you can use soft designed for safekeeping passwords. There is gnome keyring, keypass, and some other tools like that and you will certainly find them more convenient than encrypting a text file by hand.

----------

## schorsch_76

For this purpose i use app-admin/keepassx . 

Otherwise you could use gpg and your favorite editor.

----------

## John R. Graham

Definitely a TIMTOWTDI type of question. Just one of many methods:

```
~ $ echo "Hello, world!" >hello.txt

openssl enc -aes128 -in hello.txt -out hello.enc

rm hello.txt
```

You'll be prompted for a password during encryption. Also it's better to wipe the cleartext file: see app-misc/wipe, among others.

Recovering the cleartext:

```
~ $ openssl enc -d -aes128 -in hello.enc -out hello.txt
```

Again, you'll be prompted for the password.

- John

----------

## NeddySeagoon

John R. Graham,

Wipe is useless on a SSD, where you cannot do overwrite in place anyway.

I'm not sure its useful on a journaled fs either.

----------

## toralf

The clear text file might be created on a tmpfs fs ?

----------

## John R. Graham

 *NeddySeagoon wrote:*   

> John R. Graham,
> 
> Wipe is useless on a SSD, where you cannot do overwrite in place anyway.

 Yes, I know. We never move sensitive material around in the clear on solid state media for that very reason. Operationally, we always store cleartext on non-solid state, non-journaled media. 

- John

----------

## szatox

 *Quote:*   

> Wipe is useless on a SSD, where you cannot do overwrite in place anyway.

  what 'bout trim?

toralf, of course it can

If you can load data with a stdin instead if file it's even easier:

command <<< "text"

does not create input file  :Smile: 

----------

## frostschutz

 *szatox wrote:*   

>  *Quote:*   Wipe is useless on a SSD, where you cannot do overwrite in place anyway.  what 'bout trim?

 

It's harder/takes longer to delete stuff on a HDD (since you actually have to overwrite everything and wait ages for that to happen), with SSD the data is gone fast but it's less clear what happens under the hood. From a naive user point of view there is no way to get data back after the data was overwritten or trimmed, but whether the SSD actually irrecoverably erases those cells in a timely manner - who knows, the SSD is a black box, you'd have to verify this somehow for each model/firmware/...

----------

## not a day goes by

I don't know if this isn't a bit quick and dirty, but to keep track of my various not so important site/login/password combinations, I use vim encryption as shown here.

----------

