Let's say I
export FOO=var in a shell.
What would it take for someone else, root or other, to detect that the key of this variable has been set, and maybe even learn the value of it?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
Root can literally read all your processes' memory. It will take them no effort at all; they can just halt the process for which that variable is set (in your case, your shell), and execute the libc function to get the value of the variable, or directly read the memory
You literally cannot keep a secret from root, as long as that secret is accessible by your software. That's by hardware design, effectively.
Someone else is generally, on unixoids, not supposed to read the environment of one of your processes. There's access to these on much older versions of non-Linux UNIXoids, but I don't think you care about 1990's AIX?