- When Samba was installed, it created
a default configuration file you can
copy to get started:
cp
/usr/local/etc/smb.conf.sample
/usr/local/etc/smb.conf
vi
/usr/local/etc/smb.conf
- Item: 'workgroup'
Change from "MYGROUP" to whatever the
name your workgroup is.
example:
workgroup =
YourWorkgroup
remote announce =
192.168.0.255/YourWorkgroup
- Item: 'server string'
Change the server string to whatever is
appropriate. Here are some
possibilities:
%h Samba Server
%h-the-FreeBSD-Samba-Server
%h Samba
%h_Samba_File_Server_1
'%h' is a variable for the name of the
Host computer that Samba is running on.
- Item: 'log file'
The default line is:
log file =
/var/log/samba/log.%m
The %m is a variable for the client
logging in. You can use the default
naming convention, or perhaps something
like this:
log file =
/var/log/Samba-%m.log
- Set up the users so that they cannot
obliterate their configuration files.
The first section is:
Go down until you see:
========================== Share
Definitions ==========================
[homes]
comment = Homes Directories
browseable = no
writable = yes
Change this to:
[homes]
comment = Home directory for %u
on %h
browseable = no
writable = yes
path = /usr/home/%u/Docs
valid users = %S
- Let's do the public section. Just
below the commented out section called
[public] (just before the '# Other
examples' section), let's add a public
directory that can be read from and
written to by all users:
# A publicly
accessible directory, that can be
read from
# or written to by all valid users.
[public]
comment = %h Shared Public
Directory
path = /usr/home/samba/public
force directory mode = 0777
force create mode = 0777
force group = nobody
force user = nobody
public = yes
writeable = yes
read only = no
Save this file and exit.
- Now let's test the file for typos
and other errors:
/usr/local/bin/testparm | more
If you don't see any error messages,
then it's good to go.
- Next, let's create those directories
that we referenced just a bit ago:
cd /usr/home
mkdir samba
cd samba
mkdir public
cd public
- Reboot the computer:
shutdown -r
now
- CREATE ACCOUNTS ON FREEBSD FOR
WINDOWS USERS
Each Samba user must
be added to 2 user databases:
The first
is the FreeBSD OS database
The second is
the Samba user database.
adduser -v
Username: John
Full name: John Doe
Uid (Leave empty for default):
Login group [John]:
Login group is Linda. Invite Linda into
other groups? []:
Login class [default]:
Shell (sh csh tcsh bash nologin) [sh]:
bash
Home directory [/home/Linda]:
Use password-based authentication?
[yes]:
Use an empty password? (yes/no) [no]:
Use a random password? (yes/no) [no]:
Enter password:
Enter password again:
Lock out the account after creation?
[no]:
Username : John
Password : *****
Full Name : John Doe
Uid : 1004
Class :
Groups : John
Home : /home/John
Shell : /usr/local/bin/bash
Locked : no
OK? (yes/no): yes
adduser: INFO: Successfully added (John)
to the user database.
Add another user? (yes/no): no
Goodbye!
- CREATE ACCOUNTS ON SAMBA FOR
WINDOWS USERS
smbpasswd -a
John
New SMB password:
Retype new SMB
password:
Repeat the 'smbpasswd -a
user' command for all of your Samba
users
- SET SAMBA SO THAT IT LOADS ON BOOT UP
We will need to
add a line in this file so that Samba is
run when booting up.vi
/etc/rc.conf
samba_enable="YES"
Save the file and exit:
- SET PERMISSIONS FOR SAMBA SHARED
DIRECTORIES
Since we are allowing anyone to do
anything in the public directory, set file permissions:
cd
/usr/home/samba
chmod u=rwx
public
To give Read, Write and execute
permissions to the members of the Group,
enter:
chmod g=rwx
public
To give Read, Write and execute
permissions to all Others, enter:
chmod o=rwx
public
Create the users' 'Docs'
directories:
cd /usr/home
ls -lt
Looking at the list, you should see the
names of the users that you set up. For
each user, we will now create a 'Docs'
directory. Substitute each of your
users for 'username' in the following:
mkdir
John/Docs
Now since we created all these
'Docs' directories as 'root', let's give
ownership to the user. For each user
('username'), do the following:
chown John
John/Docs
Reboot and Test:
shutdown -r now
Go to a Windows computer and
double-click on 'Network-Neighborhood'.
You should be able to navigate to your
new Samba server!
Or try clicking "Start" then "Run" on
your Windows computer and typing:
\\YourFreeBSDServerIP
and click "Ok"