How to securely store passwords in a configuration file on Linux?

William Tang

I have a file in my Linux system that's called ".fetchmailrc" and it's used to configure the email address that fetchmail will get the mails from. Hence, I have to type my password and email address in plain text.

Here is how the .fetchmailrc file looks like:

set daemon 1
set logfile /home/user/.fetchmail.log
set no bouncemail
poll pop.gmail.com proto POP3 auth password no dns user "MY_EMAIL" password     "MY_PASSWORD" is user keep ssl

mda "/usr/bin/procmail -d %T"

I believe there must be a better way to do this, since if a hacker get access to my server, he can easily read the file and get my credentials.

I heard that in Linux systems there is PAM (Pluggable Authentication Modules) but I don't know if that is related to what I'm trying to do.

dirkt

No matter how you store your passwords, when running a program that doesn't prompt for your passwords, the program has to decrypt the stored password with information available on the server. A "hacker" gaining access to your server can use all information stored on the server. So he can also decrypt the password in the same way the program decrypts it.

If the scheme you use to encrypt and store your password is a bit more involved, it may take the "hacker" a bit longer.

So there's no way to do what you want: No matter how you store your password, you can't make it "hacker safe". The hacker just has to do whatever the program does (or maybe even just execute the program, and sniff the network traffic).

PAM modules have nothing to do with that. They are not for storing passwords, but provide ways to configure authentication methods for existing Linux services. A program wishing to use PAM has to be written for it.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to securely store user passwords in a Cloudant DB?

From Dev

Store passwords securely in Windows

From Dev

Store passwords of external database securely

From Dev

How do I securely store and manage 180 passwords?

From Dev

How are passwords securely shared between the client and server?

From Dev

How to securely suggest passwords that are easy to remember?

From Dev

Store passwords securely in SQL Server for use with dynamic datasources - SSIS

From Dev

Using cookies to securely store encrypted third-party passwords in DB

From Dev

How to store password in angularjs securely

From Dev

How to Securely Store Various Credentials?

From Dev

How to securely backup Jenkins configuration?

From Dev

Storing usernames and passwords securely

From Dev

How do I securely handle passwords in a Java Servlet Filter?

From Dev

How risky is it to store passwords in memory?

From Dev

Python - How to store hashed passwords

From Dev

How to store data securely on a mobile device?

From Dev

How to store a json data securely in phonegap android?

From Dev

How to store a password as securely in Chrome Extension?

From Dev

how to securely store encryption keys in android?

From Dev

How to securely store Google Authenticator secret key?

From Dev

How to store samba (cifs) password securely?

From Dev

How to securely store AWS service ids for iOS?

From Dev

Where does Linux store Wifi passwords?

From Java

How to store Configuration file and read it using React

From Dev

How to store predicates in configuration file in java

From Dev

How to store formatted strings in a configuration file?

From Dev

How to store predicates in configuration file in java

From Dev

How to store formatted strings in a configuration file?

From Dev

how to securly store passwords during development

Related Related

  1. 1

    How to securely store user passwords in a Cloudant DB?

  2. 2

    Store passwords securely in Windows

  3. 3

    Store passwords of external database securely

  4. 4

    How do I securely store and manage 180 passwords?

  5. 5

    How are passwords securely shared between the client and server?

  6. 6

    How to securely suggest passwords that are easy to remember?

  7. 7

    Store passwords securely in SQL Server for use with dynamic datasources - SSIS

  8. 8

    Using cookies to securely store encrypted third-party passwords in DB

  9. 9

    How to store password in angularjs securely

  10. 10

    How to Securely Store Various Credentials?

  11. 11

    How to securely backup Jenkins configuration?

  12. 12

    Storing usernames and passwords securely

  13. 13

    How do I securely handle passwords in a Java Servlet Filter?

  14. 14

    How risky is it to store passwords in memory?

  15. 15

    Python - How to store hashed passwords

  16. 16

    How to store data securely on a mobile device?

  17. 17

    How to store a json data securely in phonegap android?

  18. 18

    How to store a password as securely in Chrome Extension?

  19. 19

    how to securely store encryption keys in android?

  20. 20

    How to securely store Google Authenticator secret key?

  21. 21

    How to store samba (cifs) password securely?

  22. 22

    How to securely store AWS service ids for iOS?

  23. 23

    Where does Linux store Wifi passwords?

  24. 24

    How to store Configuration file and read it using React

  25. 25

    How to store predicates in configuration file in java

  26. 26

    How to store formatted strings in a configuration file?

  27. 27

    How to store predicates in configuration file in java

  28. 28

    How to store formatted strings in a configuration file?

  29. 29

    how to securly store passwords during development

HotTag

Archive