Configuring SAMBA

From MEPIS Documentation Wiki

Revision as of 11:38, 20 April 2012 by Jerry bond (Talk | contribs)
Jump to: navigation, search

Configuring shared folders with SAMBA

Contents

Introduction

SAMBA is installed in MEPIS by default and is also the protocol used by Windows machines (although Windows calls it SMB/CIFS). SAMBA is the most complete solution to share files with Windows machines on your network without making changes to the windows machines. SAMBA can also be used by many network media players and Network-attached storage (NAS) devices. SAMBA also offers some other services for interfacing with Windows networks, such as domain authentication, messaging services, and netbios name resolution.

MEPIS 11

Installation

Use

Tips and tricks

Links

MEPIS 8.5

This article or section is a stub. You can help Mepis Documentation Project by expanding it.

MEPIS 8.0 and earlier

Method 1: the old-school command line way

Your samba configuration is stored in /etc/samba/smb.conf. Check out the man page for smb.conf for details. Be sure to run testparm after you configure to make sure your config is good, and restart samba to activate the new config.

Method 2: the KDE File Sharing configuration tool

To configure samba so that you can simply right-click on a folder and share (a la Windows):

  1. Run
    1. MEPIS 6.5: KMenu --> System --> System Configuration (Settings) --> Internet & Network --> File sharing
    2. MEPIS 7.0 and 8.0: KMenu --> Control Center --> Internet & Network --> File sharing
  2. Click the "Administrator mode" button and enter your root password
  3. Select "Advanced sharing", and make sure the "Use Samba" option is checked.
  4. Click "Allowed users". If you're the only user of the machine, select "all users". Otherwise, specify the users you want to give this power to.
  5. Click "OK" to close the users window, then "Apply" on the main window.

You can also set up shares directly in the box below, by specifying a folder, or go into advanced options for the server once you've created the share.

Method 3: the KDE Samba configuration tool

This is another KDE tool located in the "Internet & Network" folder of Settings. You must run this as root.

It's pretty thorough, and mostly self-explanatory. This is probably the best tool for those new to Samba who want to set up a serious Samba server.

Method 4: Webmin

If you're going to be setting up a serious "headless server" (instead of just simple sharing from the desktop), you should read up on samba at Samba.org. Webmin also has a plugin for Samba administration, if you have advanced configuration needs.

Miscellaneous Notes

  • Always remember that folder security settings apply for samba as well. If the user account you log in with through Samba doesn't have rights to the folder locally, you won't over Samba either.
  • To set up an "open share" with no security, you need to consider the following:
    • Samba needs to be in "share mode". This emulates windows98-style sharing, with no user-security.
    • The shared folder and its subfolders need full rights for everyone (777).
    • The share you configure should be designated public, browseable, writeable, and available. Depending on the config tool you choose, this will be done different ways.

Note: This does not apply to MEPIS 8 or later, but if Samba (SMB4K) does NOT show up in the 'systray' (e.g. if you stop it manually), then you will need to re-START it, via: 'kmenu>internet>connection>samba' Once you (re)start it, it will stay on systray (and should remain there across system-reboots), unless you quit it manually.

For Method 1: A sample /etc/samba/smb.conf file with no security

This configuration has served well on my home network where access to my desktop machine's files is the goal, and security is not an issue.

# Sample configuration file for the Samba suite for Debian GNU/Linux.
#
#
# This is the main Samba configuration file. You should read the
# smb.conf(5) manual page in order to understand the options listed
# here. Samba has a huge number of configurable options most of which
# are not shown in this example
#
# Some options that are often worth tuning have been included as
# commented-out examples in this file.
#  - When such options are commented with ";", the proposed setting
#    differs from the default Samba behaviour
#  - When commented with "#", the proposed setting is the default
#    behaviour of Samba but the option is considered important
#    enough to be mentioned here
#
# NOTE: Whenever you modify this file you should run the command
# "testparm" to check that you have not made any basic syntactic
# errors.
# A well-established practice is to name the original file
# "smb.conf.master" and create the "real" config file with
# testparm -s smb.conf.master >smb.conf
# This minimizes the size of the really used smb.conf file
# which, according to the Samba Team, impacts performance
#
;*******************section global*****************
[global]

# Do something sensible when Samba crashes: mail the admin a backtrace
panic action = /usr/share/samba/panic-action %d
workgroup = BEARGROUP
server string = %h server (Samba %v)
hosts allow = 192.168.0. 192.168.1. 192.168.2. 192.168.79. 127. 10.0.0. 10.1.1.
socket options = TCP_NODELAY IPTOS_LOWDELAY 
log level = 1
dead time = 15
wins support = yes
hide unreadable = yes
passdb backend = tdbsam
dns proxy = no
host msdfs = no
max log size = 1000
map to guest = Bad Password
restrict anonymous = no
domain master = no
max protocol = NT
ldap ssl = No
server signing = Auto
oplocks = No
level2 oplocks = No
acl compatibility = winnt

;*******************section homes*****************
[homes]
comment = Home Directories
guest ok = yes
read only = no
browseable = no


[SHARED]
path = /home/silverbear/Shared
guest ok = yes
read only = no
force user = silverbear
force group = bears
case sensitive = no
strict locking = no
browseable = yes
msdfs proxy = no

[FILES]
path = /home/silverbear/01-files
guest ok = yes
read only = no
force user = silverbear
force group = bears
case sensitive = no
strict locking = no
msdfs proxy = no

[MOUNTED]
path = /mnt
guest ok = yes
read only = no
force user = silverbear
force group = bears
case sensitive = no
strict locking = no
browseable = yes
msdfs proxy = no

;*******************section printers*****************
[printers]
comment = All Printers
path = /tmp
browseable = no
printable = yes
guest ok = yes
create mask = 0700

For your own use, change "silverbear" to the username whose files are being shared, and "bears" to that user's primary group. "BEARGROUP" should be changed to the name of your network's samba workgroup.

An additional caveat: for some unknown reason, a samba client will fail to connect to the samba server machine when addressing it by machine name. When that happens — smb://klingon fails to connect — what usually succeeds is addressing the machine by network ipa. For example: smb://192.168.1.101

Again, you'll need to substitute your own network router's assigned ipa for the server machine. 192.168.1.101 is for my desktop computer on my network.

I repeat: this gives everyone on the network access to the shares that are specified! Do not use this configuration if security is an issue.

Personal tools
In other languages