[LCP]system funtion or fork or exec
Jack Lloyd
lloyd at acm.jhu.edu
Sat Feb 8 07:51:01 UTC 2003
On Fri, 7 Feb 2003, Gonzalo Sanchez wrote:
> return_value = system("ssh -N -f -L 7050:rmyserver:6565 myUser at myserver\n");
> return return_value;
>
> The code works fine. The problem with this is that I need to type my
> password to authenticate. If everything goes well then I have a ssh
> tunnel with port 7050 listening from 6565 from myserver.
>
> I would like to know how can you append the password to return_value so
> that I dont have to type the password, since this routine has to be
> automatic.
>
> Please advice if there is any other better form to do it...or how
> append the password (of course that is not too secure)
OpenSSH won't let you do the second one. You could set up a public key (w/o
password), which would let you authenticate without having to stop and ask
the user something. Of course then the only protection is the local
filesystem protections, which may not be enough, depending on the threat
model of this application. Another method would be to set up hosts
authentication with SSH; that method is probably even less safe than using
an unprotected private key.
BTW, why are you doing this? It seems like there are easier ways to do what
you are doing.
-Jack
More information about the linuxCprogramming
mailing list