Samba

Simple Samba: smb.conf

Here’s a very simplified smb.conf for Samba which you can try if you are having problems with Samba in your home network. Edit the smb.conf as follows (adjust this to suit your Linux environment and editor):

sudo gedit /etc/samba/smb.conf

Replace the contents of that file with the code below.

Note: there are two shared items at the bottom that you will want to omit or change to your use. The first (storage) is a shared hard drive. The second is a shared folder (/home/user/Videos). Modify these to suit your needs.

[global]
workgroup = home
server string = %h server (Samba, Ubuntu)
dns proxy = no
local master = yes
log file = /var/log/samba/log.%m
map to guest = bad user
max log size = 1000
name resolve order = bcast host lmhosts wins
obey pam restrictions = yes
os level = 33
pam password change = yes
panic action = /usr/share/samba/panic-action %d
passdb backend = tdbsam
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
security = share
syslog = 0
unix password sync = yes
usershare allow guests = yes
usershare max shares = 100
usershare owner only = False
cups options = raw
printing = cups
printcap name = cups
printcap cache time = 750
use client driver = yes
;guest ok = no
;guest account = nobody

[printers]
comment = All Printers
browseable = no
path = /var/spool/samba
printable = yes
;guest ok = no
;read only = yes
create mask = 0700

[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
;browseable = yes
;read only = yes
;guest ok = no

[storage]
comment = storage
path = /media/storage
writeable = yes
browseable = yes
force user = frank
force group = frank
read only = no
guest ok = yes
create mask = 0777
directory mask = 0777

[Videos]
path = /home/frank/Videos
writeable = yes
browseable = yes
guest ok = yes
force user = frank
force group = frank
By practic on April 30, 2014 | | A comment?

Setting up a Shared Hard Drive

In my home system, I have a second Hard Drive on each of my computers for common storage of projects and files.

I’d like to have this second drive accessible from all the other computers, with all permissions. It’s just a private home network, so I’m not worried about controlling who does what. I want it to be wide open.

Here’s what I do to set it up:

  1. Check the device name for the drive:
    sudo fdisk -l

    We’ll assume for the rest of the examples that the drive is /dev/sda2

  2. Create a permanent folder in /media to mount the drive into:
    sudo mkdir /media/storage
  3. Set the drive to mount at boottime in fstab:
    sudo gedit /etc/fstab
  4. For an EXT4 formatted drive:

    /dev/sda2   /media/storage   ext4   rw,user,exec,noatime   0   0

    For an NTFS formatted drive:

    /dev/sda2   /media/storage   ntfs    users,defaults   0   0

    These next three instructions only apply to EXT formatted drives. If your drive is NTFS format, you can skip them.

  5. Make root of drive writeable:
    sudo chmod +w /media/storage
  6. Give permissions to all users in the root of the drive:
    sudo chmod 777 /media/storage
  7. Set all file/folder permissions (for those already created):
    sudo chmod -R 777 /media/storage/*
    sudo chgrp -R users /media/storage
  8. This last step is a brute-force technique since I still sometimes have problems between Windows and Linux using Samba. This line forces any network access to the drive to be done with the standard Linux user and group.
    sudo gedit /etc/samba/smb.conf

    Put in the following lines (substitute your user/group name, and your path):

    [storage]
    path = /media/storage
    writeable = yes
    browseable = yes
    force user = frank
    force group = frank
    read only = no
    guest ok = yes
    create mask = 0777
    directory mask = 0777
By practic on | | A comment?