Bug 11440 - s3: smbd returned 'Permission denied' after copied a file to the read-only share.
s3: smbd returned 'Permission denied' after copied a file to the read-only sh...
Status: NEW
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services
unspecified
All All
: P5 normal
: ---
Assigned To: Samba QA Contact
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2015-08-10 04:32 UTC by Warren
Modified: 2015-08-16 15:24 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Warren 2015-08-10 04:32:33 UTC
4.1.12

When trying to to delete a file on a read-only share it does give the expected 'Read-only file system' error message.

When using a Linux (CentOS 7) or Windows 2008/Cygwin client, 'cp' gives 'Permission denied' when trying to write to a read-only share.

The error message is slightly misleading in this case, as it would make the user think that there is a file (directory) permission issue, when in fact, it is a file-system level access issue.

It looks like Samba checks the requested access mask against the share access mask through source3/smbd/open.c::smbd_calculate_access_mask(). It will return NT_STATUS_ACCESS_DENIED, which is mapped to EPERM. It doesn't differentiate whether it is a WRITE on a read-only or any other access mask denied error.