# Samba on new Server for windows network



## heraklez (Apr 23, 2009)

Hello, to everyone . I need your suggestions please. I am relativily new to FreeBSD. This is the case. I have a new machine that will act as server for my enterprise. The service I want to have is samba for sharing a folder to my windows users network.
I created a partition or slice that contains the folder I want to share and is mounted on "/mySisEnt".
I want that only registered users can access to the shared folder "/mySisEnt", registered users must have full permissions to read, write and execute betweeen them i.e. if user "phillip" creates or is reading the file "Z06", then user "charles" could read, write the same file too.

Then I'll show what I am doing, please correct to me if I am doing something wrong.

1.- Create a group named "entgroup" and 3 users for that group:

```
pw groupadd entgroup
pw useradd phillip -s /usr/sbin/nologin -g entgroup
pw useradd charles -s /usr/sbin/nologin -g entgroup
pw useradd alex -s /usr/sbin/nologin -g entgroup
passwd phillip
passwd charles
passwd alex
```

2.- Set permissions for folder "/mySisEnt".

```
chmod -R 770 /mySisEnt
```
I am not sure if to set gid bit, could anyone explain in which cases is better use it? Has any relation with "create mask = 0644" or "directory mask = 755" on the smb.conf file below??

3.- Set default group "entgroup"  for "/mySisEnt" folder:

```
chown -R :entgroup /mySisEnt
```
Is really necessary this command? Or Samba will let this with the line " force group = entgroup" ?

4. Edit and type next for smb.conf:

```
[global]
    workgroup = entgroup
    server string = Samba Server
    security = user
    create mask = 0644
    directory mask = 755

[mySisEnt]
    comment = Sys Enterprise
    path = /mySisEnt
    public = yes
    read only = no
    force user = phillip
    force user = charles
    force user = alex
    force group = entgroup
    guest ok = no
    admin users = phillip, charles, alex
    hide dot files = yes
```
I don't understand very well about "create mask"  and   "directory mask". 
And What is the difference between "force user" and "admin users" in my smb.conf file? Could explain me better please too? In my little experience I suppose type "force user" will enable to phillip, charles and alex to write and read that directory. But "admin users" which function has?

5.- Enable Samba and add users to samba:

```
echo 'samba_enable="YES"' > /etc/rc.conf
smbpasswd -a phillip
smbpasswd -a charles
smbpasswd -a alex
/usr/local/etc/rc.d/samba start
```

Points 2,3,4 I need to be sure are fine. Please, I need your suggestions, comments, thank you very much!

P.D. I am not native English speaker/writer, I hope you understand.


----------



## SirDice (Apr 24, 2009)

You've managed to install samba so I'm not going to point you to the handbook. I am going to point you to the samba documentation:

http://us6.samba.org/samba/docs/man/Samba-HOWTO-Collection/type.html


----------



## heraklez (Apr 24, 2009)

:$. Thank you


----------

