# setting up samba

## Zephaniah

Ok I'm trying to set up samba on my local network, and I want share a few directories in my home dir, read only and only allow guest access. So it set up my smb.conf like so;

```
[music]

    path = /home/dave/music

    public = yes

    only guest = yes

    writable = no

```

and start the samba server. However when I browse all the shares on the network, my PC does not even appear in the list. If I go to the cmd line and do

```
mount -t smbfs //localhost/music /mnt/samba/
```

 I get;

```
Password:

27104: tree connect failed: ERRDOS - ERRnosuchshare (You specified an invalid share name)

SMB connection failed

```

I want it to work so that it doesn't ask for a password, anyone on the network can connect and download stuff but not write anything. Anyone done this before?

----------

## bashir

 *Quote:*   

> Anyone done this before?

 

sure...   :Wink: 

You have to set in your globals:

```
security = share
```

and in your [music]

```
browseable = yes

public = yes

only guest = yes

writeable = no

```

greets

bashir

----------

## Zephaniah

Hmm, I've got that stuff in there, but my PC still doesn't show up in the list. However, if i use gnomba and specify my IP, then i can get onto it. So its running, but not being found for some reason?

----------

## bashir

please post your complete smb.conf

What kind of list do you mean?

----------

## Zephaniah

By list, I mean when I browse the SMB network (using LinNeighborhood etc) I can see everyone elses shares but my share doesn't show up. 

Here's my smb.conf

```
[global]

    workgroup = AAA

    netbios name = ZEPHANIAH

    server string = Samba Server %v

    log file = /var/log/samba/log.%m

    max log size = 50

    guest account = guest

    security = share

    encrypt passwords = yes

    smb passwd file = /etc/samba/private/smbpasswd

    socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

    wins support = yes

    dns proxy = no

 

[music]

    comment = This isn't working yet... soon though

    path = /home/dave/music

    public = yes

    only guest = yes

    writeable = no

    browseable = yes

```

...

----------

## Zephaniah

Well I fixed that, seems I can't make up my own workgroup name, so if I chage workgroup to WORKGROUP then my PC shows up. However, I still cannot actually connect to the music directory. Getting the error

```
27104: tree connect failed: ERRDOS - ERRnosuchshare (You specified an invalid share name)

SMB connection failed 
```

 still. Also it would be nice to be able to make up my own workgroup name, but not essential. The permissions for /home/dave/music are;

```
drwxr-xr-x  173 dave     users       22440 Jun 12 23:02 music
```

So that should be ok, no ?

----------

## Zephaniah

Well looks like ive found the problem, if i change the name of the guest user in smb.conf from "guest" to "dave" then everything works. I thought the guest account would be the right thing to use... Must be problems with user accounts / permissions... but I'm a little lost here... Would using my account as the guest account in samba be a security risk ?? Not sure what to do

----------

## bashir

Okay, lets figure out what's going wrong   :Wink: 

```
[global]

workgroup = AAA

netbios name = ZEPHANIAH
```

that's okay (you can definitely make your own Workgroup)

```
server string = Samba Server %v
```

Here you can choose your own name listed in the searchlist

```
log file = /var/log/samba/log.%m

max log size = 50
```

In the beginning that's fine

```
guest account = guest
```

Why do you select a special guest account  :Question:  Remove this line.

```
security = share

encrypt passwords = yes
```

Yep.

```
smb passwd file = /etc/samba/private/smbpasswd

socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
```

That's not necessary.

```
wins support = yes

dns proxy = no
```

Are you sure you have a WINS_server in your intranet  :Question: 

And even you have, you would then only accept WINS (dns proxy = no)  :Question: 

Now _before_ you restart your samba

```
chown -R dave:users /home/dave/music

chmod -R 750 /home/dave/music
```

bashir

----------

## Zephaniah

Ah ha! Got it all working, thanks for the help bashir  :Smile:  Seemed to be a permissions problem, but I turned off that wins stuff too. 

kept the socket option though cos;

```
# 5. Browser Control and Networking Options:

# Most people will find that this option gives better performance.

# See speed.txt and the manual pages for details

   socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

```

from the samba.conf.example file, so I guess its good   :Wink: 

Thanks again for helping, much appreciated.

----------

## bashir

 *Zephaniah wrote:*   

> from the samba.conf.example file, so I guess its good

 

The socket options:

A little part of "man smb.conf":

 *Quote:*   

> This option will typically be used to tune your Samba server for optimal performance for your local network. There is no way that Samba  can know what the optimal parameters are for your net, so you must experiment and choose them yourself. We  strongly suggest  you  read the appropriate documentation for your operating system first (perhaps man setsockopt will help).

 

So the most freaks using gentoo are performers - let's tune your Samba   :Twisted Evil: 

You're right, this is a good option to _start_ your performance check

```
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_KEEPALIVE SO_RCVBUF=8192 SO_SNDBUF=8192
```

(but also it is not necessary and is not a  guarantee to increase your performance)

Now have a look at this page. They are explaining how to create a "check script" and so on.

The options for socket options:

SO_KEEPALIVE

This initiates a periodic (four-hour) check to see if the client has disappeared

SO_REUSEADDR

After a crash, there is no 2 minute pause anymore. The port will be open  immediately

SO_BROADCAST

Toggle permission to transmit broadcast datagrams on the socket.

TCP_NODELAY

Forces TCP to send data immediately (without Nagle algorithm). Perhaps the best option to increase your speed

IPTOS_LOWDELAY

IPTOS_THROUGHPUT

Set these options with TCP_NODELAY. They influence the throughput for lower delay - not supported by any OS

SO_SNDBUF

SO_RCVBUF

Are options to adjust the normal buffer sizes allocated for output and input buffers. You set an absolut limit with these values

SO_SNDLOWAT

SO_RCVLOWAT

These two options vary much on your OS - also integer, so you can set an "limit". They are very seldom used

Okay, I think it's enough

- Obviously it is an overkill to set and try out all these settings, just to give an access to one simple share with guest account and without password. -

But maybe sometime there is someone who uses the search option properly and find it useful / and if you are the one please post it here.

bashir

----------

## 69link

When I copy large files from my samba-server its only hovering around 7-7,7MB/s when I get about 11-11,5 MB/s from the same server using ftp.

I've tried all the speed settings I can find on the subject, but no difference.

Therefor I wonder if anyone is able to get a steady 10MB/s+ speed from samba?

----------

## bashir

Which OS does your clients running?

There are known problems with Win98/ME - you have to change the registry to increase your speed.

Do you use hdparm?

bashir

----------

## 69link

WindowsXP in the clients (3 different).

hdparm settings=-d1 -A1 -m16 -u1 -a64

-tT results:

 Timing buffer-cache reads:   128 MB in  0.99 seconds =128.64 MB/sec

 Timing buffered disk reads:  64 MB in  1.39 seconds = 46.21 MB/sec

What speed do you get?

----------

## bashir

There are many people reporting that the speed performance is better using ftp instead of smb protocol on the same machine - even with XP.

There is  the possibility to increase the speed about 50% if you optimize your samba (socket options, hdparm, etc.), but there are also known problems on the client side. Some people even suspect M$ including performance instabilty to manipulate 3rd party products - more about this at another day    :Evil or Very Mad: 

If you are using a 100 MBit based Network - IMHO 7 MB/s is not bad, even if you get 10 MB/s over ftp. Some reports speeds like 128 KB/s (also in this forum)!

EDIT:

Try disabling a service called webclient on your clients.

bashir

----------

