SFTP Storage and public permissions I'm using Storage:SFTP (league/flysystem-sftp) to upload some files to an external server. Everything goes fine with a small issue: the files are uploaded with a 0644 (-rw-r--r--) permission.
I've tried to use 'public' option on the put method as the example from docs, like
Storage::disk('remote-sftp')->put($filename, $contents, 'public');
but if fails returning FALSE.
If I remove the 'public' parameter, eveything goes well but with the wrong permissions for file.
Is ther any way to set the uploaded file permissions to sth like 0666?
Solved!
in config/filesystems.php the SFTP config must include 'permPublic' => 0755 or the permission wanted for 'public' visibility.
Hi everyone.
I've the same kind of problem as you and I've done what you suggest.
'visibility' => 'public',
'permPublic' => 0755,
Files are uploaded and set to rwxr-xr-x but folder where the file is located is not.
I'm doing
Storage::disk('sftp')
->put(
$this->thumbToSend->relativePath(), // => folderToCreate/file.jpg
$this->thumbToSend->getData()
);
I've added some tries of setVisibility but folder is still created with 644 (rw-r--r--).
Is there a way to fix that ?
by the way I fixed it doing
Storage::disk('sftp')
->put(
$this->thumbToSend->relativePath(), // => folderToCreate/file.jpg
$this->thumbToSend->getData()
);
Storage::disk('sftp')
->setVisibility('folderToCreate', 'public');
in filesystems.php
'visibility' => 'public',
'permPublic' => 0755,
Thanks anyway :)
I got a solution by writing this only
'visibility' => 'public',
after setting visibility to the public,
permPublic and permissions values don't have any effect
'sftp' => [
'driver' => 'sftp',
'host' => env('SFTP_HOST'),
'visibility' => 'public',
//below wouldn't effect
'permPublic' => 0700,
'permissions' => [
'file' => [
'public' => 0633,
'private' => 0600,
],
'dir' => [
'public' => 0744,
'private' => 0700,
],
]
]
Please sign in or create an account to participate in this conversation.