You are not logged in.

#1 2010-07-23 15:52:11

spkag
Member
From: France
Registered: 2010-03-31
Posts: 24

Sharing with Samba

Hey all !

I've been for the past two days trying to configure my smb.conf so it shares files over network.
I've read docs, wikis, how-tos, theads et cetera but I just can't make the whole thing work.

I want Movies and Musics to be read only. This works fine.
The problem is Repo. I want it to be read/write. I've chmoded /media/Elements/Repo 777 but it still not works. What I get is read only access.

Here's my actual smb.conf so you can help me figure out what's wrong with it :

# 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 (perhaps too
# many!) most of which are not shown in this example
#
# For a step to step guide on installing, configuring and using samba,
# read the Samba-HOWTO-Collection. This may be obtained from:
#  http://www.samba.org/samba/docs/Samba-HOWTO-Collection.pdf
#
# Many working examples of smb.conf files can be found in the
# Samba-Guide which is generated daily and can be downloaded from:
#  http://www.samba.org/samba/docs/Samba-Guide.pdf
#
# Any line which starts with a ; (semi-colon) or a # (hash)
# is a comment and is ignored. In this example we will use a #
# for commentry and a ; for parts of the config file that you
# may wish to enable
#
# NOTE: Whenever you modify this file you should run the command "testparm"
# to check that you have not made any basic syntactic errors.
#
#======================= Global Settings =====================================
[global]

# workgroup = NT-Domain-Name or Workgroup-Name, eg: MIDEARTH
workgroup = WORKGROUP

# server string is the equivalent of the NT Description field
server string = Samba Server

# Security mode. Defines in which mode Samba will operate. Possible
# values are share, user, server, domain and ads. Most people will want
# user level security. See the Samba-HOWTO-Collection for details.
security = share

# This option is important for security. It allows you to restrict
# connections to machines which are on your local network. The
# following example restricts access to two C class networks and
# the "loopback" interface. For more examples of the syntax see
# the smb.conf man page
;   hosts allow = 192.168.1. 192.168.2. 127.

# If you want to automatically load your printer list rather
# than setting them up individually then you'll need this
load printers = yes

# you may wish to override the location of the printcap file
;   printcap name = /etc/printcap

# on SystemV system setting printcap name to lpstat should allow
# you to automatically obtain a printer list from the SystemV spool
# system
;   printcap name = lpstat

# It should not be necessary to specify the print system type unless
# it is non-standard. Currently supported print systems include:
# bsd, cups, sysv, plp, lprng, aix, hpux, qnx
;   printing = cups

# Uncomment this if you want a guest account, you must add this to /etc/passwd
# otherwise the user "nobody" is used
; guest account = nobody

# this tells Samba to use a separate log file for each machine
# that connects
log file = /var/log/samba/%m.log

# Put a capping on the size of the log files (in Kb).
max log size = 50

# Use password server option only with security = server
# The argument list may include:
#   password server = My_PDC_Name [My_BDC_Name] [My_Next_BDC_Name]
# or to auto-locate the domain controller/s
#   password server = *
;   password server = <NT-Server-Name>

# Use the realm option only with security = ads
# Specifies the Active Directory realm the host is part of
;   realm = MY_REALM

# Backend to store user information in. New installations should
# use either tdbsam or ldapsam. smbpasswd is available for backwards
# compatibility. tdbsam requires no further configuration.
;   passdb backend = tdbsam

# Using the following line enables you to customise your configuration
# on a per machine basis. The %m gets replaced with the netbios name
# of the machine that is connecting.
# Note: Consider carefully the location in the configuration file of
#       this line.  The included file is read at that point.
;   include = /usr/local/samba/lib/smb.conf.%m

# Configure Samba to use multiple interfaces
# If you have multiple network interfaces then you must list them
# here. See the man page for details.
;   interfaces = 192.168.12.2/24 192.168.13.2/24

# Browser Control Options:
# set local master to no if you don't want Samba to become a master
# browser on your network. Otherwise the normal election rules apply
;   local master = no

# OS Level determines the precedence of this server in master browser
# elections. The default value should be reasonable
;   os level = 33

# Domain Master specifies Samba to be the Domain Master Browser. This
# allows Samba to collate browse lists between subnets. Don't use this
# if you already have a Windows NT domain controller doing this job
;   domain master = yes

# Preferred Master causes Samba to force a local browser election on startup
# and gives it a slightly higher chance of winning the election
;   preferred master = yes

# Enable this if you want Samba to be a domain logon server for
# Windows95 workstations.
;   domain logons = yes

# if you enable domain logons then you may want a per-machine or
# per user logon script
# run a specific logon batch file per workstation (machine)
;   logon script = %m.bat
# run a specific logon batch file per username
;   logon script = %U.bat

# Where to store roving profiles (only for Win95 and WinNT)
#        %L substitutes for this servers netbios name, %U is username
#        You must uncomment the [Profiles] share below
;   logon path = \\%L\Profiles\%U

# Windows Internet Name Serving Support Section:
# WINS Support - Tells the NMBD component of Samba to enable it's WINS Server
;   wins support = yes

# WINS Server - Tells the NMBD components of Samba to be a WINS Client
#    Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
;   wins server = w.x.y.z

# WINS Proxy - Tells Samba to answer name resolution queries on
# behalf of a non WINS capable client, for this to work there must be
# at least one    WINS Server on the network. The default is NO.
;   wins proxy = yes

# DNS Proxy - tells Samba whether or not to try to resolve NetBIOS names
# via DNS nslookups. The default is NO.
dns proxy = no
restrict anonymous = no
domain master = no
logon home = \\%25N\%25U
logon path = \\%25N\%25U\profile

# Un-comment the following and create the netlogon directory for Domain Logons
; [netlogon]
;   comment = Network Logon Service
;   path = /usr/local/samba/lib/netlogon
;   guest ok = yes
;   writable = no
;   share modes = no


# Un-comment the following to provide a specific roving profile share
# the default is to use the user's home directory
;[Profiles]
;    path = /usr/local/samba/profiles
;    browseable = no
;    guest ok = yes


# NOTE: If you have a BSD-style print system there is no need to
# specifically define each individual printer
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
# Set public = yes to allow user 'guest account' to print
guest ok = no
printable = yes

[Movies]
path = /media/Elements/Videos/Movies
guest ok = yes

[Music]
path = /media/Elements/Sounds/Music
guest ok = yes

[Repo]
path = /media/Elements/Repo
guest ok = yes
read only = no

Any idea ?

Thank for reading !

Sebastian

Last edited by spkag (2010-07-23 15:55:35)

Offline

#2 2010-07-23 16:26:01

madeye
Member
From: Denmark
Registered: 2006-07-19
Posts: 331
Website

Re: Sharing with Samba

I can show you how my public share is setup. But it's almost the same as yours.

[public]
  path = /home/samba/public
  browseable = yes
  public = yes
  guest ok = yes
  writeable = yes
  readonly = no

The only difference I could spot is that I have security=user where you have security=share
and I have uncommented guest account=nobody.

Perhaps try those things and see if it makes a difference.


MadEye | Registered Linux user #167944 since 2000-02-28 | Homepage

Offline

#3 2010-07-23 16:48:42

spkag
Member
From: France
Registered: 2010-03-31
Posts: 24

Re: Sharing with Samba

Thank for trying, but this does not work either...
I've done what you've said but it makes no difference.

That's weird.

Offline

#4 2010-07-23 18:08:52

MoonSwan
Member
From: Great White North
Registered: 2008-01-23
Posts: 881

Re: Sharing with Samba

Instead of "read only = no" try "writeable = yes".  I believe they're the same thing but it's all I can think of to try.

Offline

#5 2010-07-23 19:18:35

madeye
Member
From: Denmark
Registered: 2006-07-19
Posts: 331
Website

Re: Sharing with Samba

Right now I'm not sure what the problem is. But if you set security=user, then you need to add your users to the samba password database, else you will have trouble with the access to the share.

The guest user is normally mapped to nobody. You should make sure the user exists.

You could try to add writelist=guest to the share definition.

EDIT: I have something that might help you. Try to make a line in the share like the following:

map to guest = bad user

EDIT2: Found a page describing a similar setup. http://tech.waltco.biz/2008/01/26/priva … urityuser/ Maybe you can use some of it.

Last edited by madeye (2010-07-23 20:17:10)


MadEye | Registered Linux user #167944 since 2000-02-28 | Homepage

Offline

#6 2010-07-24 13:13:14

spkag
Member
From: France
Registered: 2010-03-31
Posts: 24

Re: Sharing with Samba

Thanks to both of you, but none seems to work. sad
I've tried the different tips and even put them together.

This is what it looks like at the moment :

[global]
        # Browsing / Identification #
        netbios name = ARCH-PC
        server string = %h Server (Samba, ArchLinux)

        # Authentication #
        security = user
        encrypt passwords = true
        map to guest = bad user
        guest account = pcguest

        passdb backend = tdbsam
        obey pam restrictions = yes
        invalid users = root

# Public Share.  Mount this on a Unix client with the following.
# sudo mount -t smbfs -o username=[username],password=[password],\
# rw,uid=[your Unix user],gid=[your Unix group] \
# //[netbios or ip of server]/private /path/to/mount/point
#
# Optionally use a credentials file and credentials=/path/to/credentials (see below)

[Movies]
        comment = Movies
        path = /media/Elements/Videos/Movies/
        guest ok = yes

[Music]
        comment = Music
        path = /media/Elements/Sounds/Music/
        guest ok = yes

# Public Share.  Mount this on a Unix client with the following.
# sudo mount -t smbfs -o username=,password=,\
# rw,uid=[your Unix user],gid=[your Unix group] \
# //[netbios or ip of server]/public /path/to/mount/point

[Repo]
        comment = Repo
        path = /media/Elements/Repo/
        read only = no
        create mask = 0777
        directory mask = 0777
        writelist=guest
        guest only = no
        guest ok = yes

All the three folders are in ro. Can't put Repo in rw...

Last edited by spkag (2010-07-24 13:54:26)

Offline

#7 2010-07-24 19:20:30

MoonSwan
Member
From: Great White North
Registered: 2008-01-23
Posts: 881

Re: Sharing with Samba

Silly question but you are running "testparm" every time you change your smb.conf file right?  It tells you if your config is right or not.

Other silly question, you are restarting the samba daemon(s) after each change right? I mention these because they're very easy to overlook.

Offline

#8 2010-07-25 13:12:50

spkag
Member
From: France
Registered: 2010-03-31
Posts: 24

Re: Sharing with Samba

Yep, don't worry, I did it. smile

"testparm" output seems normal, exept one error, but I don't know if it's relevant :

rlimit_max: rlimit_max (1024) below minimum Windows limit (16384)
params.c:Parameter() - Ignoring badly formed line in configuration file: This is the main Samba configuration file. You should read the

The "You should read the" sentance is not finished, and what follows after is OK.

Offline

#9 2010-07-27 16:13:54

madeye
Member
From: Denmark
Registered: 2006-07-19
Posts: 331
Website

Re: Sharing with Samba

The second error actually indicates that you have an error in your config file. Did you perhaps remove a # from the mentioned line? I don't think it would matter, as I think samba is smart enough to just ignore that one line. But you should make sure there are no errors in the config.

The rlimit line I'm not sure about what to do. Maybe it's a compiling option? I'll have to look into that when I get back home in the weekend.


MadEye | Registered Linux user #167944 since 2000-02-28 | Homepage

Offline

#10 2010-07-27 19:17:35

toad
Member
From: if only I knew
Registered: 2008-12-22
Posts: 1,775
Website

Re: Sharing with Samba

Another silly question, but did you restart the samba daemon after every change?


never trust a toad...
::Grateful ArchDonor::
::Grateful Wikipedia Donor::

Offline

#11 2010-07-28 06:33:32

stryder
Member
Registered: 2009-02-28
Posts: 500

Re: Sharing with Samba

Could it be that the problem is at the other end - when you mount the samba share? I have that problem sometimes. Chmod 777 -R the mount folder as root usually solves it for me.

Offline

#12 2010-07-28 16:08:36

spkag
Member
From: France
Registered: 2010-03-31
Posts: 24

Re: Sharing with Samba

@madeye : haha, acctualy I must have removed a # before a comment. That's why there was a badly formed line. However, the problem is still not soved and the rlimit_max line is still here.

@toad : I said I did it. wink

@stryder : Already chmoded it 777 -R !

Thanks for helping.

Offline

#13 2010-07-28 16:36:18

eldragon
Member
From: Buenos Aires
Registered: 2008-11-18
Posts: 1,029

Re: Sharing with Samba

im not sure if this will help but:

the guest account must exist (in your case, pcguest) in the samba server.

create the user with useradd, if you dont want it to have a login, map its shell to /usr/bin/false

then this user must have rw permissions on the share.

Offline

#14 2010-07-28 16:55:33

spkag
Member
From: France
Registered: 2010-03-31
Posts: 24

Re: Sharing with Samba

The user exists and the whole folder is 777. smile

Offline

#15 2010-07-28 17:30:32

madeye
Member
From: Denmark
Registered: 2006-07-19
Posts: 331
Website

Re: Sharing with Samba

Do you have a user on that machine that has a samba login too? Then try to access the share with that (samba) username and password.


MadEye | Registered Linux user #167944 since 2000-02-28 | Homepage

Offline

#16 2010-07-29 14:25:29

spkag
Member
From: France
Registered: 2010-03-31
Posts: 24

Re: Sharing with Samba

Acctualy, I've chmoded 777 and chowned pcguest:users recursivly, and my samba user (pcguest) is not even allowed to make a directory :

[pcguest@arch-pc Repo]$ mkdir test
mkdir: impossible de créer le répertoire « test »: Permission non accordée

Offline

#17 2010-07-29 14:52:10

skunktrader
Member
From: Brisbane, Australia
Registered: 2010-02-14
Posts: 1,679

Re: Sharing with Samba

What are the permissions of the parent of Repo?

Offline

#18 2010-07-30 11:04:50

spkag
Member
From: France
Registered: 2010-03-31
Posts: 24

Re: Sharing with Samba

Well, here it is :

drwxr-xr-x 14 sebastian root 32768  1 janv.  1970 Elements

Offline

Board footer

Powered by FluxBB