The best example, would be the ~/.ssh folder, or the linux keychain.

Why is the ~/.ssh folder considered safe? When researching this, people said that the permissions of the folder would give enough security, since if someone then still has access to the folder, he/she would have root access - which means you have bigger problems. However, if some virus were to run shell-code or hijack the control-flow of a process running under the same user privileges as the owner of the ~/.ssh, won't that virus just be able to read the private keys? Heck, even firefox can just read the file contents.

Same thing for the linux keychain. If it is unlocked at boot, why is it safe at all?

The real reason I am asking this, is because I am writing a program which needs to store a secret somewhere, which needs to be retrieved without user interaction. If my program can just retrieve it, why not another? How do you store plain-text secrets securely?

  • We have many, many questions like that here. Take a look around to see what meets your needs.
    – schroeder
    Nov 7, 2023 at 10:19


Browse other questions tagged .