[LCP]system funtion or fork or exec

Gonzalo Sanchez Gsanchez at roinetwork.com
Mon Feb 10 22:13:01 UTC 2003


I am logging to 10 different socket servers query a command.  To get statistics. 

-----Original Message-----
From: Jack Lloyd [mailto:lloyd at acm.jhu.edu]
Sent: Friday, February 07, 2003 6:51 PM
To: linuxcprogramming at lists.linux.org.au
Subject: Re: [LCP]system funtion or fork or exec


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

_______________________________________________
This is the Linux C Programming List
:  http://lists.linux.org.au/listinfo/linuxcprogramming List




More information about the linuxCprogramming mailing list