Ensuring certain processes do not show up in process table

i've read somewhere a long time ago that there's a way to hide the workings of a script in sub functions so that when run, it doesn't show up in the process table.

is this really possible?

for instance, i need to run a command that has a password in it. and when that;s being run, it can be seen from the process table if someone is running a "watch" on the command.

how can i avoid this?

Best solution is to avoid having passwords in your scripts/on the command line using public/private keys (aka ssh/sftp).

If this is not possible many commands support passing of passwords via environment variables. You could revoke all access to your script via permissions to stop users viewing script and noting the passwords. Then have a sudo rule to allow the script to be run as secured user.

1 Like

Assuming that you want the process to not require input and depending on what you are connecting to that needs a password, there are probably better options anyway. There are at least:-

  • SSH keys as Chubler_XL suggests for ssh or sftp type connections
  • Using trusted externally validated connections, e.g. sqlplus / to connect to an Oracle database
  • Using secured configuration files to connect to mysql databases
  • Using a here document to feed the credentials in (not recommended though)

What is your target that you need to connect to?

Whatever you choose, you need to be careful that the method cannot be read and subverted for other purposes.

Robin

1 Like