是否可以使用ssh连接上传文件?

时间:2012-05-30 19:52:03

标签: php ssh

我正在使用ssh连接到服务器,我想知道是否有一个上传文件的命令,比如放在sftp连接上。

include('Net/SSH2.php');
include('Crypt/RSA.php');

$key = new Crypt_RSA();

$key->loadKey(file_get_contents('/pathtokey.pem'));


$ssh = new Net_SSH2('ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com');
if (!$ssh->login('user', $key)) {
exit('Login Failed');
}

非常感谢

1 个答案:

答案 0 :(得分:1)

您可以使用SCP

通过SSH发送文件

http://php.net/manual/en/function.ssh2-scp-send.php

相关问题