在CentOS5上禁用已弃用的密码后如何使用PHP执行SFTP操作?

问题描述 投票:0回答:1

我有用于SFTP操作的PHP代码,目前在CentOS5机器上运行良好。禁用以下不推荐使用的密码后,它停止工作。

这里是密码列表

密钥交换:diffie-hellman-group1-sha1密码:arcfour256,arcfour128、3DES-cbc,河豚-cbc,cast128-cbc,arcfour]

这里是当前代码段

$connection = ssh2_connect('ftp_url', 'ftp_port');
php ssh sftp deprecated centos5
1个回答
0
投票

这有效。这种方法实际上强制代码使用指定的密码

$methods = array(
         'hostkey'                 => 'ssh-rsa,ssh-dss',
         'client_to_server'        => array(
                 'crypt'  => 'aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc',
                 'comp'   => 'none'
         ),
         'server_to_client'        => array(
                 'crypt'  => 'aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc',
                 'comp'   => 'none'
         )
);

$connection = ssh2_connect( $this->config[$ftp]['ftp_url'], $this->config[$ftp]['ftp_port'], $methods );
© www.soinside.com 2019 - 2024. All rights reserved.