Samba Installation and Configuration (Sharing Files with Windows)


Samba Configuration


There are four things that one can do with samba:

  1. Share a Linux drive with  Microsoft windows machines
  2. Share a windows drive with  Linux  machines
  3. Share a Linux printer with  Microsoft windows machines
  4. Share a windows printer with  Linux machines

Web Based Samaba Configuration Tool
To configure from web or browser , there is a tool SWAT.
SWAT – Samab Web Administration Tool

It works through xinetd.conf.
1. Go to /etc/xinetd.d/ and edit swat.
2. Change the key word
                only_from = host_name like linux1 or 192.168.1.1
3. Kill and run xinetd daemon

4. Go to /etc/httpd/conf/httpd.conf
                Change the following  tag
                ServerName linux1 or 192.168.1.1 or FQDN like linux1.dot.com
5. Kill and run httpd

Now type the following line through your browser.

http://192.168.0.1:901/

Now go to Network Neighborhood and see the shared directories of Linux machines.

 

Configuration of samba in text-mode


  1. Share a Linux drive with windows machine (Step by Step)
    1. Fist check either samba software is installed or not by issuing the command
# find / -name smb.conf –print
The default location if smb.conf file is in /etc/

Text mode samba configuration

    1. Configure smb.conf file. This file has the following sections

    1. [global]
    2. [homes]
    3. [printers]
    4. share section with name like [public]
    5. [netlogon]


  1. [global] section
[global]
workgroup = samba
server string = Samba Server

Here the workgroup parameter determines the server’s workgroup name , or domain name in NT. And server string describes the server, which will work as samba server.

Hosts allow = 192.168.0.  

This will restrict access to the Samba server based on IP address.

loading printers = yes

printcap name = /etc/printcap
printing = bsd

The global printer parameter determines how Samab will share any local printers on the server. The load printers parameter automatically reads the /etc/printcap file announce all the printers in /etc/printcap file.

local master  =  no
; os level = 33 (OS level should be lower if NT is the master browser)
;domain master = yes or no
;domain logon = yes or no
;logon script = %m.bat (log will be by machine name)
;logon script = %U.bat  (log will be by user name)

guest account = nobody
security = share
log file = /usr/local/samba/var/log.%m


[homes] section

[homes]
comment = Home directories
path = /home/%S (Here %S is the sahre name or exported dir)
browseable = no
writable = yes

Share Sections
[public]
comment = Public staff
path = /home/public
;valid users = user1 user2 user2
public = yes or no
writable = yes

[tmp]
comment = tmp is the shared directory
path = /tmp
;valid users = user1 user2 user2
public = yes or no
writable = yes

[alpha]
comment = tmp is the shared directory
path = /auto/alpha
;valid users = user1 user2 user2
public = yes or no
writable = yes

[printer]
comment = My shared printer is hp6l
;valid users = user1 user2 user2
path = /home/printer/spool (This is the spool directory)
printer = hp6l
public =  yes or no



3.       Run isuue the following command

# /usr/sbin/smbd ( smbd daemon for controlling file and print sharing)
# /usr/sbin/nmbd (netbios name resolution and browsing function)
4.       Now test samba is working or not , issue the command
# nmblookup hostname
example:
# nmblookup linux1
The output of this command will be following

Querying linux1 on 192.168.0.1
192.168.0.1 linux1 <00>

This means samba is working fine.


5.       Utilities for testing samba
a.       testparm
format of testparm
Testparm smb.conf host-name
Example:
# testparm smb.conf linux1

b.       testprns
example:
testprns hp6l /etc/printcap

Now read the following instructions

Now see the shared directories of a windows machine
Issue the command
# /usr/bin/smbclient  -L machine-name (like PC1)

To go to any share from linux machine, run the command
# smbclient  \\\\hostname\shared-dir  passwd
Here passwd may be any string for windows 95/98 PCs


Mounting windows shared director from Linux           
Issue the command
# /usr/bin/smbmount  //pc-name/mount-point   user –P passwd or user%passwd



Comments

Popular posts from this blog

English to Bengali Names of Vegetables, Legumes and Spices

How To Remove Powered By Blogger From Blogger

Advantages of Rapid Application Development