Pages

May 20, 2007

Minimal smb.conf for Linux

This tip is for setting up anonymous share using samba 3 under Linux with really minimal smb.conf. I assume you want to share directory /data read only. For sharing it read-write, make sure it has correct permissions (chmod 777 /data) and uncomment last line :-)
cat /etc/samba/smb.conf
[global]
 netbios name = darkstar
 server string = darkstar
 guest ok = yes
 security = share
[data]
 path = /data
# read only = no

Edit in 2016: For Fedora 23, you need to change this config for

cat /etc/samba/smb.conf
[global]
 netbios name = darkstar
 server string = darkstar
 guest ok = yes
 security = user
 map to guest = bad user
[data]
 path = /data
# read only = no


Also you need to change selinux fcontext of shared directory:

# semanage fcontext -a -t samba_share_t  "/data(/.*)?"
# restorecon -Rv /data
### this third line may be needed if /data is managed by local user
# setsebool -P samba_enable_home_dirs 1

Edit in 2020:
# cat /etc/samba/smb.conf
[global]
 server string = darkstar
 guest ok = yes
 security = user
 workgroup = workgroup
 guest account = nobody
 map to guest = bad user

Also on client Windows 10 Enterprise and Education, you have to
Go into Local Group Policy Editor (gpedit.msc)
Navigate into Administrative Templates - Network - Lanman Workstation.
Then the Setting : Enable insecure guest logons has to be set to "Enable".

On client Windows 10 Home and Pro its enabled by default.


No comments:

Post a Comment