Friday, January 15, 2010

Simple Samba/CIFS Configuration

Any time I have to do something with Samba, I run into stupid configuration and permissions issues. I just set up a dead simple Samba config and am documenting it here for next time. Possibly someone else might get some use out of it too.

Some reading I based this on: creating a public share in Samba, and some Samba on Ubuntu docs.


  • Ubuntu 9.10 Karmic as the smb server
  • Whatever Samba 3.x it comes with
  • Windows and Linux client machines
  • Anyone on has access: not secure, but convenient
  • Machine called myhostname is the file server, at IP


  1. On the file server, myhostname in this example, create a user smbuser to act as the 'guest' in Samba. Client machines that don't authenticate will act as this user:
    sudo adduser smbuser
    Then make sure /etc/passwd and /etc/group have lines something like this:
    # /etc/passwd
    smbuser:x:1001:1001:Samba user,,,:/home/smbuser:/usr/sbin/nologin
    # /etc/group
  2. Edit /etc/samba/smb.conf:
    netbios name = myhostname
    workgroup = WORKGROUP
    server string = File Server
    security = user
    map to guest = bad user
    guest account = smbuser
    create mask = 0644
    directory mask = 0755
    hosts allow =
    hosts deny =
    unix extensions = no  # unless you REALLY need them
    # Simple share that anyone can read/write to
    path = /data/photos
    browsable = yes
    guest ok = yes
    read only = no
  3. Client linux machine's /etc/fstab (Make sure smbfs is installed: sudo apt-get install smbfs):
    // /data cifs username=smbuser,password=,uid=bob,gid=bob 0 0
  4. Client Windows machine: just browse to \\ or \\myhostname

No comments:

Post a Comment