Linux - providing environment variables

It’s just interesting if there is a way to protect environment variables in the * nix system so that they cannot be read from any text file, but are available in the environment.

I know that we can always use file system permissions for .bashrc / .bash_profile, but what if certain variables (like db passwords) should be completely hidden?

One way to do this is to write some kind of / perl script program for:

  • Take tabs from plain text file and encrypt / hash content (and then get rid of plain text file)
  • Use the same for decrypting file runtime and exporting values ​​from decrypted output (I know this program can be used to dump decrypted values ​​somewhere, but it doesn’t concern me now)

Is there any other better and more obvious way to achieve this?

Thank!

-Gaurav

+5
source share
3 answers

In no case. Even if you hide it from a text file, it is still available from /proc/<pid>/environ(linux) or ps e(another unix).

+5
source

Who are you protecting them with?

: "". , , . ? "vim"? , , .

+2

, . , , , . /proc/###/environ , , .

, , , , - , / , , . ( - ), .

, -, / CGI Apache, : group apache:apache, , CGI, , apache:apache , rw-r----- (640). , , - , root, apache, apache.

, , , .

0

All Articles