Samba 服务器的主要程序

smbd:提供对服务器中文件、打印资源的共享访问

nmbd:提供基于 NetBIOS 主机名称的解析


建立 Samba 用户数据库文件

默认数据库文件位/var/lib/samba/private/passdb.tdb

(自定义共享位置,默认是上面的位置)

smbclient
命令,查看及登录使用共享

 smbclient  -L 192.168.4.11

 smbclient 
-U sunboy //192.168.4.11/tools

例:[root@localhost
~]# smbclient -U sunboy //192.168.4.11/tools -U hunter

例:[root@localhost
~]# smbclient -L 192.168.4.11 -U hunter

ps:cifs是samba默认的文件类型





共享文件实验


Yum omsta;; samba -y安装一下samba


( yum install samba •y 
Loaded plugins; fastestmirror. tangpacks 
Loading mirror speeds from cached hostfile 
esolving Dependencies 
Running transaction check 
• • package samba. x86 _ 64 
be installed 
4.8.3-4.e17 for package: samba.4.8.3-4.et7.x86„64 
•toots 4.8.3•4.e17 for package: 
Dependency: tibxattr-tdb.samba4.so(SAmBA for package: samba-4.8.3-4 
Dependency: for package: samba.4.8.3-4.e17.x86 04 
processing 
. processing 
Processing 
.e17.x86 64 
processing 
0:4.8.3-4.e17 
Dependency: samba- 
Dependency: 
samba • Common





切换到samba目录下,cp备份一下



( root@localhost 
[ root@localhost 
[ root@localhost 
cd /etc/samba/ 
sambal# 
total 20 
-rw-r--r--. 
-rw-r--r--. 
-rw-r--r--. 
1 root root 
1 root root 
1 root root 
( root@localhost sambal# 
[ root@localhost sambal# 
20 oct 31 2018 tmhosts 
706 Oct 31 2018 smb.conf 
11327 oct 31 2018 smb.conf.example 
cp smb.conf smb. conf . bak


Vim smb.conf 文件。




全局中添加

 Map to guest = bad user

这样在登录共享文件夹的时候输入erveryone就可以了


编辑内容

在下面添加

[aa]

Comment
= gg

Path
= /tmp

Public
= yes

Writable
= yes


[global] 
wo rkg roup 
= SAMBA 
security — 
— user 
bad user 
map to uest = 
passdb backend = 
dbsam 
printing 
= cups




File 
Edit View Search Terminat Help 
valid users "S, 
browseable = NO 
read only NO 
inherit acts = Yes 
(printers] 
comment = printers 
path z /var/tmp 
printable = Yes 
Create mask 0600 
browseable No 
[printSl 
comment = printer Drivers 
path = /var/lib/samba/drivers 
write list = @printadmin root 
force group @printadmin 
create mask = 0664 
directory mask = 0775 
(aal 
comment = 
gg 
path /tmp 
public = yes 
writable = yes


 

 


重启一下smb服务

 


[ root@localhost systemctt restart smb 
1 
[root@localhost



在外面用win + R 输入\\192.168.10.1 可以进入了



乛 × 
、 , , 19 ~ 8.1 1 
0 
, 0 ' 19216B16r