Anda di halaman 1dari 7

Home | Guides and Tutorials | What's New?

| Com

Samba Configuration - Linux/Windows Conn


by Tammy Fox
Last Modified: Wednesday, 19-May-2004 11:54
Introduction

Samba can be used to allow connectivity between Linux an


Windows(95,98,NT,2000). Samba can be used to share printer
connect to an NT domain, and many other useful features. Ho
explains the steps involved in basic configuring Samba for fil
more complex topics, visit the Samba website or type the com
a Linux machine with Samba installed. Configuring Samba is
configuration file /etc/smb.conf that is usually located under t
Everytime you modify this file, Samba must be restarted for th
effect.

Basic Samba Information

Starting, Stopping, and Restarting Samba


Most Linux distributions come with scripts to start, stop, an
properly. If yours does not, use the commands under the Opti

Runlevel Script
Optional Command

Start Samba
/etc/rc.d/init.d/samba start
/usr/sbin/smbd -D and /usr/sbin/nmbd -D

Stop Samba
/etc/rc.d/init.d/samba stop
killall -TERM smbd and killall -TERM nmbd

Restart Samba
/etc/rc.d/init.d/samba restart
killall -HUP smbd and killall -HUP nmbd

Samba Log Files


All Samba actions such as login attempts and file transfers
/var/log/samba directory. Under this directory the actions are
name. For example, all actions from the machine named "Mor
file /var/log/samba/log.morpheus. User actions can also be lo
named /var/log/log.smb and /var/log/log.nmb. This is configur
using the option log file. For example, to log actions by mach
following line:
log file = /var/log/samba/log.%m
Windows Workgroup
You can specify which Windows Network Neighborhood Wo
machine is seen in and the description of the machine by edit
smb.conf:
workgroup = WORKGROUPNAME
server string = MACHINE DESCRIPTION
Access Control
smb.conf can be used to allow and deny access by IP addre
listing IP addresses or subnets on the lines beginning with ho
deny. Examples:
Example
Explanation

hosts allow 192.168.10.0/255.255.255.0


Allow all hosts in the given network/netmask

hosts allow 160.210 EXCEPT 160.210.24.56


Allow all hosts beginning with 160.210 except 160.210.24.56

hosts allow 192.168.10 192.168.20


allow all hosts beginning with 192.168.10 or 192.168.20

hosts deny 130.74


deny all hosts beginning with 130.74

Using Samba with Windows NT 4.0 Service Pack 3 or higher

Samba can be configured to send plain-text passwords or e


The Microsoft SMB protocol originally used plain-text passwo
Service Pack 3 or higher for Windows NT 4.0, they changed th
encrypted passwords. Samba must be configured for this to c
4.0 machines. One way to do this is to modify the NT registry;
this option all NT machines must be configured to use plain-t
time-consuming and might cause conflicts elsewhere. The ea
to configure Samba to send encrypted passwords. This can b
following steps:
1. Create a separate password file for Samba based on your
will create Samba users for every user that already exists
this by executing the command cat /etc/passwd | mksmbp
/etc/smbpasswd. The script should be in the /usr/bin direc
here.
2. Make sure only root has permission to read and write to t
with the command chmod 600 smbpasswd.
3. The script does not copy the passwords. To set the Samb
users thus enabling their Samba accounts, use the comm
username for each user.
4. Edit the smb.conf file to include the two lines
encrypt passwords = yes
smb passwd file = /etc/smbpasswd
5. Restart Samba with /etc/rc.d/init.d/smb restart

Print Sharing from Linux to Windows

The following section is usually included in the sample smb


printers defined in the /etc/printcap file to be shared. If not ad
following lines in smb.conf:
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no

Then, just restart Samba and add the Linux printer to a Windo
would any other Window's shared printer. The printer name w
specified in the /etc/printcap file such as lp.

Creating a Common Share Directory for Multiple Users

You can create a share directory more than one user has pe
similar to a Linux/Unix group definition. The best way to expla
example:
[myshare]
comment = Share for John and Sam
path = /usr/share
valid users = john sam
public = no
writable = yes
printable = no
create mask = 0765

This shares the directory /usr/share for only the users john an
which means both john and sam have write permissions to th
files/directories created in the shared directory will have the p

Connecting to a Samba Machine in Linux

To connect to a Samba machine (Windows or Linux running


command line, execute the command (replace MACHINENAM
the appropriate values)
smbclient //MACHINENAME/sharename

If you want to pass a different username to the Samba Serv


command (replace username with your username).
smbclient //MACHINENAME/sharename -U username

If a password is associated with the username, you will be


you are authorized by the SMB protocol, you will be at a smb:
similar to an ftp session where get, put, pwd, ls, etc. can be u
help for a list of commands.

Configuring Windows Machines

Connect to a Linux machine running Samba the same way


Windows machine - browse through Network Neighboorhood
entering a password if required. Note: Windows 95/98 only pr
and assumes the Windows Login name as the username. You
user on your Linux box with your Windows Login or create a
same username on your Linux machine. Optionally, you can h
and password for Windows 95/98/NT/2000 be the same as you
username and password and it will not prompt for a password
security issue if others have access to your system. Your call

Official Website

• Samba Website

What's Related
• Cable Modem Configuration
• Dial-up Networking Configuration using Red Hat netcfg
• Dial-up Networking Configuration using KDE's Kppp
• ipchains Configuration - Network Connection Sharing
• Network Configuration Using the Command Line
• Network Configuration Using Red Hat netcfg
• Network Configuration Using Red Hat linuxconf
• Network Configuration Using SuSE YaST
• Squid Proxy Server Configuration
• Samba Configuration - Linux / Windows Connectivity

All Rights Reserved Linux Headquarters © 20


Linux is a registered trademark of Linus To
All logos are registered trademarks of their respec
Last modified: Wednesday, May 19, 200

Anda mungkin juga menyukai