0

Does anyone have an idea how to pass something interactively to a script which does not support interactive mode? Is there any shell feature / application etc. or any other way to wrap the script / application by something in such a way that I could pass arguments and then hide them? I don't want my sensitive data such as password were visible in keyboard buffer, on the process list etc. Is it possible?

  • 2
    Can you ask a more specific question (or at least provide an *actual* example)? There are too many hypotheticals here to figure out what problem you're actually trying to solve. – larsks Mar 25 '16 at 14:10
  • After re-reading your question and a little coffee, I believe this link should help. http://stackoverflow.com/questions/3830823/hiding-secret-from-command-line-parameter-on-unix – IT_User Mar 25 '16 at 14:22
  • And this one. http://serverfault.com/questions/592744/how-to-hide-a-password-passed-as-command-line-argument – IT_User Mar 25 '16 at 14:43

1 Answers1

0
  • First, check if this is really necessary. Some software rewrites its command line after startup.
  • If your executable is a binary, there are ways to dynamically load your program into an existing process.
  • You were talking about a script. Assuming it is Bash or compatible, you can easily write a wrapper that reads your secret, then sources the existing script.

Because no new process is generated, the secret will not be part of any command line, but it will be available as shell parameter (here $1) while yourscript is executing:

#!/bin/bash
read secret
. <yourscript> "$secret"
Community
  • 1
  • 1
Michael Jaros
  • 4,586
  • 1
  • 22
  • 39