Before we proceed, here is a little
information about Samba for those new to it.
Samba is a tool ,or more accurately a
suite of tools, that implement the SMB protocol (server message block
protocol).This is the protocol that Windows uses for file sharing and
general networking.This is why Samba is important: because it allows Linux
and Windows to speak the same language when file sharing. Samba works over
the TCP/IP protocol and this fact is important in setting up the Network
Interface cards (NICs) in each computer. You must have a NIC ( or a
motherboard with a NIC port) in each computer.
For this tutorial I am assuming that we
are using Windows XP on the Windows PC and that the two computers are
connected via a router.

1.First we
need to set up the NICs and give each computer an IP address.The default
settings on Suse 9.1 for the NIC hardware is to assign IP's automatically.
However, we will do it manually so you get a feel about what is going on.
On my router, the router itself has a fixed IP address of 10.0.0.2 .Check
your documentation to see what it is for your router. We are going to
assign the XP machine with an IP of 10.0.0.4 and the Suse box an IP of
10.0.0.3
Before we go on, it's best at this point
to deactivate any firewalls temporarily, so that we can rule them out of
obstructing our networking. When the network is up and running we can
reactivate them.
2.
Setting up the Windows XP PC
a) .Go to CONTROL PANEL and then NETWORK
CONNECTIONS and right click the LAN connection and choose properties.
b) .Highlight the TCP/IP and choose
properties.
c) .Now inout the following data :Use the
following IP address: 10.0.0.4 and use .Subnet mask: 255.255.255.0
d) .Default gateway: 10.0.0.2 (Here put in
the IP address of your router)
e) Use the following DNS server: 10.0.0.2
(Here put in the IP address of your router)
f) Now go to CONTROL PANEL and then FOLDER
OPTIONS and untick simple file sharing.This gives us more options on how
we can share files.
g) .Now go to NETWORK CONNECTIONS in the
control panel and choose SET UP HOME OR SMALL OFFICE NETWORK on the left
hand side panel
h) Go through the wizard and choose a name
for the netwhich net connection you will use
i) Finally we need to give the XP computer
a name that we can refer to it as.Right click MY COMPUTER and choose the
computer name tab and click change to give a name you prefer.For this
example we will choosea computer name 'x'
That's pretty much it for XP.
3.
Setting up for SuSE 10.0
a) .Open YAST and choose NETWORK
DEVICES then NETWORK CARD
b) Choose to change the network card (or
edit if it has not been configred yet)
c) .Highlight the network card in the list
and choose EDIT
d) .Choose STATIC ADDRESS SETUP and put in
the IP of your choosing.For this example we will put in 10.0.0.3
e) Input Subnet mask: 255.255.255.0
f) .Now click on HOST NAME AND NAMESERVER
CONFIG
g) .Input for Name server 1 : 10.0.0.2
(the router) then click NEXT
h) Click on Routing and input 10.0.0.2 as
the default gateway
9.Click FINISH and that is the NIC set up
for linux
4. At this point, we should have a working
TCP/IP connection between the two computers. We can test this by pinging
each computer. From Linux, open a terminal and:
# ping -c 5 10.0.0.4
The linux box will now try and ping the XP
computer 5 times via the TCP/IP protocol. You should get a series of 5
pings in the terminal with how many milliseconds it took to connect to the
IP 10.0.0.4 (the XP machine).
If this doesn't work, go back and re check
the previous steps and make sure that no firewalls are in the way.
Especially check the default XP firewall on the LAN connection (right
click it and choose 'security' and untick firewall)
Now, if it's working ok, try and ping the
Linux box from the XP machine. Open the comand prompt (all
programs....accessories...command prompt) and type :
ping 10.0.0.3
Once you can ping each computer from the
other, you know you have a successful LAN .
Now we just need to set up Samba :
5. Setting Up Samba
Make sure Samba is installed .If not,
install it from the CDs usng YAST. To get Samba to work ,all the
configuration is done via the smb.conf file which is
/etc/samba/smb.conf . You can edit this file yourself but
we will use YAST. Open YAST then NETWORK SERVICES and SAMBA SERVER
a) .Tick ENABLE SAMBA SERVER and choose
file and printer sharing and input the name of the WORKGROUP. If you
remember, our workgroup is called "ivesnetwork"
b) .Input a server name (this can be
anything that is meaningful) and a NETBIOS name. We will choose a netbios
name of "samba1"
c) .Click NEXT and ADVANCED. Choose EDIT
and you can select which directories you will share from your linux box.
Alternatively just select 'share homes' which will share your home
directory (/home/username)
d) .Click FINISH and your done.
e) .It's a good idea to check out the
smb.conf file to see what has been written to it.I tend to use a
simplified smb.conf that looks like:
[global]
workgroup = network
username map = /etc/samba/smbusers
guest ok = yes
netbios name = samba
encrypt passwords = yes
comment = Linux PC
[ives data]
comment = ives home folder
path = /home/ives
writeable = yes
browseable = yes
read only = no
This provides a very simplified file
sharing where only my /home/ives directory is shared
Here are some brief explanations of what
the setting mean:
Under [global] (i.e. the whole of Samba):
"workgroup" is the name of the Network all the computers use the same
workgroup name
"username map" is the place where samba
users are stored
"netbios name" is the name of the server
"encrypt passwords" is important for XP
Under [ ives data,] we give the path to
the folder that will be shared with XP. Remember to make this directory
available to all by: # chmod 777 /home/ives/data
Writeable, means that XP can write to this
folder, browseable means you can browse it and read only = no means just
that.
f) .Now you must create a samba user:
The best idea is to use your Linux user
name and password .Type into the terminal as root:
# smbpasswd -a ives ..
where "ives " is your Linux user name
.Then input your password.
Now restart samba by:
#/etc/init.d/smb restart
g) You can test the syntax of your
smb.conf file by
# testparm.
# /usr/bin/smbclient -L samba1 -U ives
Where "samba1" is the netbios name you
chose and "ives" is the samba user you created.
then enter the samba password at the
prompt
You should get something that looks like:
If you get something like the above, you
are in business.and samba is working ok
i) Now, from XP you should be able to open
network neighborhood and go to ‘view workgroup computers'. You should see
your Linux and XP computer there.Double click the Linux one and it will
ask you for your samba username and pw.Then you will get to the share you
designated in the smb.conf (/home/ives). You should be
able to read and write to it.
j) From Linux, in order to access your
shared files on XP you need to do the following: We need to use the
smbmount command to mount the share.
Create a mount directory.For example as
root do
# mkdir /mnt/xp
On Xp, the "Shared Documents " folder is
shared by default.
If we want to mount this directory on our
Linux box we do:
Then one would do
# smbmount //x/SharedDocs /mnt/xp
where x is the name of the XP computer and
"SharedDocs" is the name of the "Shared Documents " folder on XP
To unmount the mount, just do:
#smbumount /mnt/xp
k) Making the Mount Permanent
smbmount does not make the mount
permanent. If Linux is rebooted, you will have to mount the share again.
To make the mount occur each time you start the Linux workstation, you can
put an entry in your /etc/fstab file of the form:
//servername (i.e. the name of
the XP computer) /sharename (i.e. name of shared file in XP) /mountdirectory
smbfs username=windowsuserename,password=windowspassword 0 0
In my example I would use:
//x/SharedDocs /mnt/xp smbfs username=defaults,password=defaults
0 0
The username and password are only
needed if the Windows share is set up to require them. If a username and
password are not required, you may just replace them with the word
defaults.
6. More info
can be found here:
The Official Samba How To Guide
Samba FAQ's
How to
set up samba
Basic Samba guide
Step by Step Samba