Linux/Samba/Public Share

From Omnia
< Linux‎ | Samba
(Redirected from Linux/Samba/Guest File Server)
Jump to navigation Jump to search

new root public share

[global]
  workgroup = WORKGROUP
  netbios name = SHARE
  server string = Guest File Server

  security = user
  map to guest = Bad User
  guest account = root

  follow symlinks = yes
  wide links = yes
  unix extensions = no

  # Disable printers:
  load printers = no
  printing = bsd
  printcap name = /dev/null
  disable spoolss = yes
  show add printer wizard = no

[pub]
  comment = file share
  path = /pub
  browseable = yes
  read only = no
  guest ok = yes
  strict locking = no

Quick Public File Server

Summary: Guest access file server (no password, but may have to enter some random user name when windows asks for a username/password)

Install Samba:

# RHEL
yum install samba
# Debian
apt-get install samba

Add guest user (better to not use 'nobody' user): [1]

adduser guest

Create a share folder:

mkdir /pub
chown guest:guest /pub
chmod g+ws /pub

Samba configuration files:

/etc/samba/smb.conf

Note: "When it comes to "security = share" just say no!"

/etc/samba/smb.conf:

[global]
        #default# workgroup = WORKGROUP
        netbios name = FILES
        server string = Guest File Server

        #default# security = user
        #guest account = root
        guest account = guest
        map to guest = Bad User
        username map = /etc/samba/smbusers

        ##  Follow symlinks
        #follow symlinks = Yes
        ##  Follow symlinks outside of a share path
        wide links = Yes
        ##  Support hard links, disable wide links
        unix extensions = No

        ## Disable printers:
        load printers = No
        printing = bsd
        printcap name = /dev/null
        disable spoolss = Yes
        show add printer wizard = No

        create mask = 0664
        directory mask = 2775

[pub]
        comment = Guest access share
        path = /pub
        read only = No
        guest ok = Yes
        force user = guest
        force group = guest

/etc/samba/smbusers:

# Unix_name = SMB_name1 SMB_name2 ...
root = administrator admin
guest = guest pcguest smbguest

Use 'testparm' to test configuration

testparm
testparm smb.conf

Restart Samba:

# RHEL
service smb restart
# Debian
service samba restart

Windows: (optional)

net use \\files\pub /user:guest

Windows Access:

\\files\pub
# may have to enter some random user name when windows asks for a username/password

References:

root public share

[global]
  workgroup = WORKGROUP
  netbios name = SHARE
  server string = Guest File Server

  security = share
  guest account = root
  #guest account = nobody

  follow symlinks = yes
  wide links = yes
  unix extensions = no

  # Disable printers:
  load printers = no
  printing = bsd
  printcap name = /dev/null
  disable spoolss = yes
  show add printer wizard = no

[pub]
  comment = file share
  path = /pub
  browseable = yes
  # read only = yes  (default)
  read only = no
  guest ok = yes
  strict locking = no

Note in Samba 4.2 the "security = share" is deprecated and replaced with: [2]

security = user
map to guest = Bad User

Old Method

See Linux/Samba/Public Share/Old Method

keywords