I am trying to upload a file over sftp
using laravel.
Here's SFTP configuration:
SFTP_HOST=X.X.X.X
SFTP_USERNAME=root
SFTP_PASSWORD=
SFTP_KEY_PATH=/root/usr/es_server.pem
config > filesystems.php
'sftp' => [
'driver' => 'sftp',
'host' => env('SFTP_HOST'),
'port' => 22,
'username' => env('SFTP_USERNAME'),
'root' => '/uploads/',
'privateKey' => env('SFTP_KEY_PATH'),
'visibility' => 'public',
'permPublic' => 0755,
'directoryPerm' => 0755
]
This is working properly on my local, with the same host
and key
.
But from deployed server, I get this
"Could not login with username: root, host: x.x.x.x"
Logging into the deployed server, and connecting the host
server over sftp
is working for the root
user and the same key
.
root@dma:~# sftp -i es_server.pem root@x.x.x.x
Connected to x.x.x.x
sftp>
I checked for firewalls on the host server if it is blocking the deployed server but no blocks found.
What could be the issue? What am I missing?