我需要通过PHP的SSH2功能连接到某些亚马逊EC2实例来获得一些信息,并在我的后台显示出来。
I need to connect to some Amazon EC2 instances through php's ssh2 functions to get some info and display it on my backoffice.
有没有办法在SSH2功能做同样的我通过命令行SSH?
Is there a way in ssh2 functions to do the same I do when connecting through the command line ssh?
ssh -i path_to_file/key.pem host01-ec2
感谢
您可以使用 openssl_pkey_get_public
提取酒吧/私钥,然后用的 ssh2_auth_pubkey_file
授权。
You can use openssl_pkey_get_public
to extract the pub/private keys, and then use ssh2_auth_pubkey_file
to authorize.