Page 1 of 1

Samba Share is Not Writable From Windows

Posted: 2019/09/07 23:08:02
by peoriadrupaluser
Hi,

I have Samba 3.6.23 and I am trying to get a share to be writeable from Windows machines. I can access the share from Windows but I am not able to write to the share regardless of what changes I make to the permissions.

The folder share is owned by the root user and the group samba. The user accessing the share from Windows is a member of the Samba group.
Folder permission is 755 and g+s

This is the configuration.

[SHARENAME]
comment = Share Name
path = /usr/share_name/
browseable = yes
public = yes
guest ok = yes
writeable = yes
create mask = 0655
directory mask = 2775
read only = no
map archive = yes
map system = yes

Any help is greatly appreciated.

Thanks,
Josh

Re: Samba Share is Not Writable From Windows

Posted: 2019/09/07 23:47:08
by TrevorH
Did you see the section in the supplied /etc/samba/smb.conf?

Code: Select all

#---------------
# SELINUX NOTES:
#
# If you want to use the useradd/groupadd family of binaries please run:
# setsebool -P samba_domain_controller on
#
# If you want to share home directories via samba please run:
# setsebool -P samba_enable_home_dirs on
#
# If you create a new directory you want to share you should mark it as
# "samba-share_t" so that selinux will let you write into it.
# Make sure not to do that on system directories as they may already have
# been marked with othe SELinux labels.
#
# Use ls -ldZ /path to see which context a directory has
#
# Set labels only on directories you created!
# To set a label use the following: chcon -t samba_share_t /path
#
# If you need to share a system created directory you can use one of the
# following (read-only/read-write):
# setsebool -P samba_export_all_ro on
# or
# setsebool -P samba_export_all_rw on
#
# If you want to run scripts (preexec/root prexec/print command/...) please
# put them into the /var/lib/samba/scripts directory so that smbd will be
# allowed to run them.
# Make sure you COPY them and not MOVE them so that the right SELinux context
# is applied, to check all is ok use restorecon -R -v /var/lib/samba/scripts
#
#--------------

Re: Samba Share is Not Writable From Windows

Posted: 2019/09/08 21:23:33
by peoriadrupaluser
@TrevorH - Thank you for reiterating this. I appreciate it. I did not run the samba-share_t before. I am tried to run this with the chcon command but Ia m getting errors.

I ran:

Code: Select all

chcon -tR samba-share_t /usr/share/
CentoOS Returns

Code: Select all

chcon: failed to change context of `/usr/share/' to `unconfined_u:object_r:samba-share_t:s0': Invalid argument
I would appreciate any help in figuring out how to execute this.

Thanks!

Re: Samba Share is Not Writable From Windows

Posted: 2019/09/08 23:11:55
by TrevorH
You can't use /usr/share as that's a system owned directory and owned by root:root. Share somewhere else.

Re: Samba Share is Not Writable From Windows

Posted: 2019/09/08 23:42:31
by peoriadrupaluser
@TrevorH,

I am sorry if I am missing something simple.

I created a new folder called shares in / and made it owned by a new user called sambausr and added them to my samba group. Then I gave all the same permissions above. I tried the same commands with the new location (/shares/share) and I get the same error.

Is the issue the location of the folder or the permissions? Am I doing something else wrong?

I appreciate your clarification.

Thanks,
Josh