Вы находитесь на странице: 1из 15

1

What is SAMBA?

Samba is the way a Linux computer


communicates with SMB and CIFS.

With Samba, you can make your Linux computer a part


of a Microsoft-based network.

Computers with various Microsoft operating systems


can communicate with each other using the Server
Message Block (SMB) protocol.

When a Microsoft operating system shares files or


printers on a TCP/IP network, it uses the Common
Internet File System (CIFS).

2
Example

SMB CIFS NetBios

NetBios CIFS SMB

SMBD / NMBD CIFS

SMBD / NMBD CIFS SMB

3
How SAMBA works ?

SAMBA
SAMBA A
B

Server
Server
192.168.0.253
192.168.0.253
/var/zoom
/var/zoom

Linux
Linux Windows
A
Windows
Client
Client Client
B
Client

/smb
/smb Z:
Z:
User1 User2

4
How SAMBA works ?

SAMBA
SAMBA
Server
Server
192.168.0.253
192.168.0.253
/smb
/smb

User1

Linux
Linux Windows
Windows
Client
Client Client
B B
Client

Share
Share
User2

5
Requirements

Packages
samba-common-3.0.10-1.4E.i386.rpm
samba-3.0.10-1.4E.i386.rpm
samba-client-3.0.10-1.4E.i386.rpm
Port Numbers
137 NetBios Name Service
138 NetBios Datagram Service
139 NetBios Session Service
Configuration File
/etc/samba/smb.conf
Service
smb
Daemons
nmbd
smbd

6
SAMBA Configuration Scenario 1

SAMBA
SAMBA
Server
Server
192.168.0.253
192.168.0.253
/var/zoom
/var/zoom

Linux
Linux Windows
Windows
Client
Client Client
Client

/smb
/smb Z:
Z:

7
Configuring SAMBA Server

Install
Installthe
thepackage
packageby
byusing
usingone
oneof
ofthe
theinstallation
installationmethods
methods
[root@comp1~]#
[root@comp1~]# mount 192.168.0.250:/var/ftp/pub/RedHat/RPMS//mnt
mount 192.168.0.250:/var/ftp/pub/RedHat/RPMS/ /mnt
[root@comp1
[root@comp1~]#
~]#cd
cd /mnt
/mnt
[root@comp1
[root@comp1~]#
~]#rpm
rpm -ivh
-ivh samba*
samba* --force
--force --aid
--aid

Create
Createdirectory
directoryto
tobe
beshared
shared
[root@comp1~]#
[root@comp1~]#mkdir
mkdir/var/zoom
/var/zoom

Open
Openconfiguration
configurationfor
forediting
editing
[root@comp1~]# vi /etc/samba/smb.conf
[root@comp1~]# vi /etc/samba/smb.conf

8
/etc/samba/smb.conf

To
Tochange
changethe
theoptions
options
[myshare]
[myshare]
comment
comment==Zoom’s
Zoom’sshare
share
path
path==/var/zoom
/var/zoom
valid
validusers
users==user1
user1 user2
user2
public
public==no
no
writable
writable =yes
= yes
printable
printable==no
no
create
create mask==0765
mask 0765

9
Samba Server

To
Torestart
restartthe
theSamba
Sambaservices
services
[root@comp1 ~]# service smb restart
[root@comp1 ~]# service smb restart

To
Totest
testsmb.conf
smb.conf file
file
[root@comp1
[root@comp1~]#
~]#testparm
testparm

10
Samba Server

Create
CreateUsers
Users
[root@comp1 ~]# useradd user1
[root@comp1 ~]# useradd user1
[root@comp1
[root@comp1~]#
~]#useradd
useradduser2
user2

Create
Createdirectory
directoryto
tobe
beshared
sharedAssign
Assignthem
them Samba
Sambapassword
password
[root@comp1~]#
[root@comp1~]#smbpasswd
smbpasswd aa user1
user1
[root@comp1~]#
[root@comp1~]#smbpasswd
smbpasswd aa user2user2
Samba
Samba password entries can be foundat
password entries can be found at/etc/samba/smbpasswd
/etc/samba/smbpasswd

11
Samba Client Linux

Mount
MountMethod
Method
[root@comp1 ~]# mkdir /smb
[root@comp1 ~]# mkdir /smb
[root@comp1
[root@comp1~]#
~]#smbmount
smbmount //192.168.0.253/myshare
//192.168.0.253/myshare
/smb o username=user1
/smb o username=user1
Password
Password ::****
****
[root@comp1
[root@comp1 ~]# cd/smb
~]# cd /smb

FTP
FTPMethod
Method
[root@comp1
[root@comp1~]#
~]#smbclient
smbclient //192.168.0.253/myshare
//192.168.0.253/myshare
UU user1
user1
Password
Password ::****
****
smb/>
smb/> ls
ls

12
Samba Client Windows

Map
MapDrive
DriveSamba
SambaDrive
Drive
Right click My Network Places
Right click My Network Places
Select
Select Map
MapNetwork
NetworkDrive
Drive
In
Inthe
thedialog
dialogbox
boxprovide
provide
Drive : Z:
Drive : Z:
Folder
Folder :: \\192.168.0.253\myshare
\\192.168.0.253\myshare
It
It opens authentication dialogbox,
opens authentication dialogbox,where
where
username
username::user1
user1
password
password::****
****
Open
Open Windows
WindowsExplorer
Explorer to
tofind
findZ:
Z:drive
drivemapped
mappedto
to
Linux shared folder.
Linux shared folder.

13
SAMBA Configuration Scenario 2

SAMBA
SAMBA
Server
Server
192.168.0.253
192.168.0.253
/smb
/smb

Linux
Linux Windows
Windows
Client
Client Client
Client

Share
Share

14
SAMBA Server Client

Mount
MountMethod
Method
[root@comp1 ~]# mkdir /smb
[root@comp1 ~]# mkdir /smb
[root@comp1
[root@comp1~]#
~]#smbmount
smbmount //192.168.0.253/myshare
//192.168.0.253/myshare
/smb o username=Administrator
/smb o username=Administrator
Password
Password ::****
****
[root@comp1
[root@comp1 ~]# cd/smb
~]# cd /smb

FTP
FTPMethod
Method
[root@comp1
[root@comp1~]#
~]#smbclient
smbclient //192.168.0.253/myshare
//192.168.0.253/myshare
UU Administrator
Administrator
Password
Password ::****
****
smb/>
smb/> ls
ls

15

Вам также может понравиться