TransWikia.com

How to add permissions to windows user in samba on ubuntu server

Server Fault Asked by matthew tranmer on February 17, 2021

I have this samba network drive configured in ubuntu server for my windows computer and i want to make it so i can read/write but other users can not read or write to the network drive. How can i edit the smb.conf so i can do this?
this is my smb.conf at the moment:

[share]
    comment = Ubuntu File Server Share
    path = /srv/samba/share
    browsable = yes
    guest ok = yes
    read only = no
    create mask = 0755

2 Answers

To be thorough:

First, create a samba user if you haven't already:

useradd sambauser
smbpasswd -a sambauser

Enter and confirm the password for sambauser.

Change that part of your /etc/samba/smb.conf to this:

[share]
comment = Ubuntu File Server Share
path = /srv/samba/share
valid users = sambauser
browsable = yes
writable = yes
write list = sambauser
create mask = 0755

Make sure that the directory and everything that might be inside has the proper ownership and permissions:

chown -R sambauser:sambauser /srv/samba/share
chmod -R 755 /srv/samba/share

Make sure that you have allowed samba through selinux with this command if it is enabled. If selinux is not enabled then you can skip this part:

chcon -R -t  samba_share_t /srv/samba/share

Lastly, make sure that the ports are open for samba on the firewall.

firewall-cmd --permanent --zone=public --add-port=445/tcp
firewall-cmd --permanent --zone=public --add-port=139/tcp
firewall-cmd --reload
systemctl restart firewalld

If using `iptables:

iptables -A INPUT -p tcp --dport 445 -j ACCEPT
iptables -A INPUT -p tcp --dport 139 -j ACCEPT
iptables-save
iptables-restore

Restart the samba service and then log in with the credentials of sambauser.

Answered by Nasir Riley on February 17, 2021

Turn off guest permissions and log into the shared drive with the owners credentials from the SAMBA machine to which owns the folder.

Answered by Eric Jurgens on February 17, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP