LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Cannot write to a RHEL Samba share in Windows 8.1 (https://www.linuxquestions.org/questions/linux-server-73/cannot-write-to-a-rhel-samba-share-in-windows-8-1-a-4175533958/)

mixignal 02-13-2015 07:03 PM

Cannot write to a RHEL Samba share in Windows 8.1
 
I am trying to mount a Redhat local directory /local3/user1 which is owned by the user user1, in Windows 8.1 for read/write operation.
After successfully mounting the share in Windows 8.1, I can read the share in Windows but when I try to create a file in the shared folder I get an error window with the following error:

-----Error Start----
Destination Folder Access Denied
You need permission to perform this action
---- Error end ---------

I followed the steps from this link https://access.redhat.com/documentat...t_Servers.html

Also I have a similar share from a Debian Linux workstation and that works fine.

----- Here's the content of /etc/samba/smb.conf ------
[global]
workgroup = MSHOME
server string = %h server
#
log file = /var/log/samba/log.%m
max log size = 50
#
security = user
passdb backend = tdbsam
#

[user1]
comment = User1 share
path = /local3/user1
valid users = user1
public = no
writable = yes
printable = no
create mask = 0765

## I have omitted some of the printer/etc share info for brevity

----- End of content of smb.conf ------

Then I created the smb user with the following command

$sudo smbpasswd -a user1

And in Windows when I Map the drive I give the address:
\\[IP address\user1

and use samba credentials.

It is successfully mounted and I can read BUT I CANNOT WRITE to it.

Any help will greatly appreciated.

Thank You

Ser Olmy 02-14-2015 12:50 PM

There are two sets of permissions involved here: The permissions on the SMB share object, and the permissions on the file system objects involved.

What are the permissions and ownership settings on the shared directory (/local3/user1)?

mixignal 02-14-2015 07:06 PM

Permission for the linux SMB share
 
The permissions for /local3/srout is
drwxr-xr-x. 3 srout srout 4096 Feb 13 19:44 .

**NOTE** user1 is srout. I used user1 in the prblem statement to keep it generic.

I have a same permission in a debian system and that mounts R/W fine.

Do you see any issue there ?

Thanks for your response.

zafar_dandoti 02-14-2015 08:55 PM

Did u set the selinux context accordingly.
Code:

chcon -t samba_share_t /path/to/share
If that works then add it permanantly
Code:

semanage fcontext -a -t samba_share_t /path/to/share
Code:

restorecon -R /path/to/share

mixignal 02-15-2015 09:52 AM

[SOLVED] Works
 
SELinux change worked! Thanks a lot

One caveat, it seems like the existing folders/files in /local3/srout (the Samba share) are not writable from Windows, only the new ones. Not a big deal for me now but it will nice to get around that.

Also, never used SELinux in my life. If there's a good userguide/tutorial for it, please feel free to recommend.

Thanks again

zafar_dandoti 02-15-2015 11:04 AM

Naviget to /local/srout directory and check the selinux file context are properly set(recursively) to all files and folder.
Code:

#ls -lZ
All files and directory should have context type to samba_share_t

mixignal 02-15-2015 11:30 AM

was missing -R in chcon
 
Forgot to do recursive chcon (-R option).
Once I do that it's all fixed.

Thanks a lot again.

zafar_dandoti 02-15-2015 12:02 PM

If u are satisfied with solution mark it as solved. Thank you!


All times are GMT -5. The time now is 05:43 AM.