Im trying to use the Laravel Flysystem with the sftp adaptor from PHP League (league/flysystem-sftp). Using Laravel 5.4 and version 3.7 of the Flysystem.
When I attempt to put a file on the server, i get the message:
Cannot connect to someadress.com:22. Error 13. Permission denied
Here is the code:
$box = new Filesystem(new SftpAdapter(Config::get('flysystem.connections.sftp')));
$box->put('test.txt', 'bar');
and the connection details from the config:
'sftp' => [
'driver' => 'sftp',
'host' => 'someadress.com',
'port' => 22,
'username' => 'someuser',
'password' => 'ArndomPa55',
'privateKey' => '/home/user/.ssh/id_rsa',
'root' => '/var/www/html/site/box/',
'timeout' => 20,
],
When I make an SSH connection from the server where this is running, it connects fine, without a password prompt, so it is using the Private Key. So not sure why this isn't working.
I've checked the secure log on the receiving server and nothing is in there.
'password'
option along with'privateKey'
, which won't work if the password is not the private key passphrase. When the two are used together, the value of'password'
must be the passphrase for the private key, not the password of the remote user. – Ladylike