Alcedema
asked on
PHP: shell_exec ssh but how to make the script allow initial ssh connection?
I'm developing a system to scp public keys in the form of authorized_keys and authorized_keys2 to new machines, then a script will connect via:
shell_exec ('ssh -2 user@ip command');
The only problem will be that when connecting for the first time, you get the message:
The authenticity of host 'hostname (ip)' can't be established.
RSA key fingerprint is xx:xx:xx:x:xx:xx:xx:xx:xx: xx:xx:xx:x x:xx:xx:xx .
Are you sure you want to continue connecting (yes/no)?
This stalls the script until it's entered manually. Is there a way to get the script to either bypass this by using an ssh flag (havent found one yet) that automatically applies the new host to the known_hosts file; or is there a way to allow the script to parse a message to this 'existing' shell saying 'yes'?
shell_exec ('ssh -2 user@ip command');
The only problem will be that when connecting for the first time, you get the message:
The authenticity of host 'hostname (ip)' can't be established.
RSA key fingerprint is xx:xx:xx:x:xx:xx:xx:xx:xx:
Are you sure you want to continue connecting (yes/no)?
This stalls the script until it's entered manually. Is there a way to get the script to either bypass this by using an ssh flag (havent found one yet) that automatically applies the new host to the known_hosts file; or is there a way to allow the script to parse a message to this 'existing' shell saying 'yes'?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER