tags:

views:

105

answers:

1

I must use ssh2_exec to install some packages on linux servers. Some of the packages require some answers when installing so I must be able to provide those answers using the ssh2_exec function from PHP. I already know the answers to those questions but it's hard to enter the response when the question is prompted. Example:

//        Build command for OpenVPN
ssh2_exec ( $connection, "./build-ca" );

The above command will trigger openvpn to be configured so it asks a few questions such as:

Country Name (2 letter code) [US]:

For the above question I must answer "US" and hit enter to continue etc. Any ideas how to do this using ssh2_exec function?

A: 

The only clean solution is not executing programs expecting user input. Check if build.ca has a config file where you can give default values and if yes, upload a such a file via SCP and then execute build-ca so it uses these values.

ThiefMaster
Yeah I've done that but it still asks. The US part of the question above is already entered by me in the config file.
Ian Rob