This is actually quite complicated (I will stop talking because it may be the way I do not know), especially if the user has access to the /proc
file system for your process.
Perhaps the best way to prevent people from seeing your command line arguments is to not use command line arguments :-)
You can program your arguments in a corresponding protected file called (for example) myargs.txt
, then run your program with
myprog @myargs.txt
Of course, you will have to modify myprog
to handle the "arguments in file" script.
Alternatively, you can set the arguments to environment variables and use your getenv
program.
However, I do not know of a single method that could protect you from a process with the appropriate privileges (for example, one root
run).
paxdiablo
source share