File and Folder Permission on an external disc are invalid

I’m not sure if this is a setup problem or a bug, so any help is welcome:

I’ve multiple environments with my website. While dev and staging write the uploads in the storage/app/uploads directory, prod is configured with an external disc in the filesystems

filesystems.php

        'uploads' => [
            'driver' => (env('APP_ENV') === "prod") ? 'sftp' : 'local',
            'root' => (env('APP_ENV') === "prod")
                ? env('UPLOADS_ROOT')
                : storage_path('app/uploads'),
            'url' => (env('APP_ENV') === "prod")
                ? env('UPLOADS_URL')
                : '/storage/app/uploads',

            # Only used on sftp driver
            'host' => env('UPLOADS_HOST'),
            'port' => (int) env('UPLOADS_PORT'),
            'username' => env('UPLOADS_USERNAME'),
            'password' => env('UPLOADS_PASSWORD'),

            # Probably only local
            'visibility' => 'public',
            'throw' => false,
        ],

While the folders and files are written with 755 and 644 in the storage/app folder, they’re written with 700 and 644 on the external drive which leads to accessability problems of those uploads (or visibility problems if it’s for images).

I’ve this here in the .env, too:

DEFAULT_FILE_MASK=664
DEFAULT_FOLDER_MASK=775

Any idea why this could happen?

Thanks for the support already :slight_smile:

EDIT: I also recognized that the file paths are wrong if you quote the FOLDER and FILE_MASK in the .env with single quotes. That’s definitly strange o_O

The external drive may need a “umask” set, which is the default permissions for newly created files and folders. This is outside the scope of Laravel’s filesystem drivers.