2

I want a write a program that run an executable image without creating a new process... I want to do this because I want to use plink that send a password to a remote ssh server...

The plink program sends the password provided in command line .. If I use fork and exec functions someone can see the password provided in command line using process explorer or ps -aef or cat /proc//cmdline .. How to avoid this security hole..and this program has to be run on both linux and windows ..

2
  • 3
    I do hope this isn't another one of those 'I want to do x without doing x' questions... Commented Oct 8, 2009 at 12:35
  • He wants to Run a executable in another process without running a new process, so I think it might be :-) Commented Oct 8, 2009 at 12:48

6 Answers 6

7

Set up your SSH server to use RSA public/private key authentication instead of passwords. This is usually a better choice anyway for SSH in general. See http://www.google.com/search?q=set+up+ssh+rsa.

Sign up to request clarification or add additional context in comments.

Comments

3

Most programs which accept a password on the command line also accept it via a file, a pipe, or an environment variable. Why not use one of these other mechanisms?

6 Comments

Environment variable works particularly well. Very little setup to use, and no trace on the file system at all.
unless you type 'export PASSWORD=iamgod' before you run the program, in which case it's in your command history...
this program is plink..and it is a third party program
Then use a public/private key pair as recommended in the plink documentation.
Environment variables are visible via the /proc file system in exactly the same way the command line is. The only secure way to transfer the data is via an anonymous pipe or socket (i.e. not a disk file or network socket), but you can bind that to stdin/stdout of the child process before the fork obviously.
|
0

If your worry is that the password is visible, you may be better off encrypting the password. An encrypted password has little value to the observer, so you can use methods like exec() and fork()

Comments

0

To avoid being prompted for a password or using a plain text password in places where it could be "sniffed" from, you should almost certainly set up public-key authentication (assuming you're bound to plink...).

Using pipes is also a good solution.

Comments

0

I found a plink wrapper for unison that does what you need, mainly waiting for a password prompt on plink's STDOUT, then feeding it a response on STDIN.

Hope this works for you

Comments

-1

well, why send the password in the beginning? use the password to encrypt some text+time stamp, and then send to authorize yourself?

and No, I don't know a way to call another program without creating a new process.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.