金沙手机APPSamba服务配置详解

Samba服务配置详解

作为服务器端实现:

smb:service message block    ----progress:smbd  port:445/tcp

netbios:本地名称解析  --------progress:nmbd  port:137/udp
138/udp 139/tcp

安装:
[[email protected]
/]# yum install samba -y

启动:
[[email protected]
/]# /etc/init.d/smb start
Starting SMB services:                                    [  OK  ]
[[email protected]herry
/]# /etc/init.d/nmb start
Starting NMB services:                                    [  OK  ]

Windows查看:

金沙手机APP 1

配置文件:
[[email protected]
/]# cd /etc/samba/
[[email protected]
samba]# ls
lmhosts  smb.conf  smbusers

Samba的用户:
    1.系统用户
    2.密码是独立的,非为/etc/shadow中的密码
    设置密码 smbpasswd -a username

[[email protected]
~]# smbpasswd  -help
When run by root:
    smbpasswd [options] [username]
otherwise:
    smbpasswd [options]
 
options:
  -L                  local mode (must be first option)
  -h                  print this usage message
  -s                  use stdin for password prompt
  -c smb.conf file    Use the given path to the smb.conf file
  -D LEVEL            debug level
  -r MACHINE          remote machine
  -U USER              remote username
extra options when run by root or in local mode:
  -a                  add user
  -d                  disable user
  -e                  enable user
  -i                  interdomain trust account
  -m                  machine trust account
  -n                  set no password
  -W                  use stdin ldap admin password
  -w PASSWORD          ldap admin password
  -x                  delete user
  -R ORDER            name resolve order

设置用户密码:(尽量于操作系统不一致)
[[email protected]
~]# smbpasswd -a samba
New SMB password:
Retype new SMB password:
Added user samba.

[[email protected]
home]# cd samba/
[[email protected]
samba]# ls
[[email protected]
samba]# touch a

金沙手机APP 2

[[email protected]
samba]# ll
total 4
-rw-r–r– 1 root  root  0 May 27 10:12 a
-rwxr–r– 1 samba sherry 3 May 27 10:13 b.txt

以上默认访问家目录

配置文件解释:
[[email protected]
samba]# cp smb.conf{,.bak}
[[email protected]
samba]# vim smb.conf
[global]
        workgroup = WORKGROUP
        server string = Samba Server Version %v
        netbios name = sherry  #windows上显示的主机名称  会转为大写
;      interfaces = lo eth0 192.168.12.2/24 192.168.13.2/24    #
监听接口  ip  网卡 网络
;      hosts allow = 127. 192.168.12. 192.168.13. #监听主机
      log file = /var/log/samba/log.%m  #日志 %m变量替换  用户名
      max log size = 50  #每个日志50kb  超过则滚动日志
        security = user  #user根据用户  share匿名 
server账号密码集中管理 后两项deprecated
        passdb backend = tdbsam  #密码保存方式
        load printers = yes  #打印机
        cups options = raw  #通用raw模式
 
 
[homes]
        comment = Home Directories
        browseable = no
        writable = no    #家目录不让写
;      valid users = %S
;      valid users = MYDOMAIN\%S
 
# 定义一个共享目录
[node1]
        comment=shared node1
        path=/sambashared/node1  #登入用户对此目录要有操作权限
        writable = yes          #所有用户进程写权限
;      write list = samba ,user2  #进程能写白名单  与上述不要一起开启 
用@groupname  +groupname  设置组
;      browseable = no  #不在白名单中的用户对此目录是否能够显示
;      guest ok = yes  #不在白名单中的用户是否能够访问
 ;      read only=yes #只读
;      writable=no#是否能写 与read only有一个即可

配置文件定义一个共享目录:
[node1]
        comment=shared node1
        path=/sambashared/node1
        writable = yes
        write list = samba

测试配置文件语法,并显示最终配置:
[[email protected]
node1]# testparm 
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit
(16384)
Processing section “[homes]”
Processing section “[printers]”
Processing section “[node1]”
Loaded services file OK.
Server role: ROLE_STANDALONE
Press enter to see a dump of your service definitions
 
[global]
    server string = Samba Server Version %v
    log file = /var/log/samba/log.%m
    max log size = 50
    client signing = required
    idmap config * : backend = tdb
    cups options = raw
 
[homes]
    comment = Home Directories
    browseable = No
 
[printers]
    comment = All Printers
    path = /var/spool/samba
    printable = Yes
    print ok = Yes
    browseable = No
 
[node1]
    comment = shared node1
    path = /sambashared/node1
    write list = samba
    read only = No

linux client:
[[email protected]
node1]# yum -y install samba-client

登入
[[email protected]
node1]# smbclient  //sherry/node1 -U samba
Enter samba’s password: 
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.23-35.el6_8]
smb: \> put anaconda-ks.cfg 
putting file anaconda-ks.cfg as \anaconda-ks.cfg (249.4 kb/s) (average
249.4 kb/s)
smb: \> get a
getting file \a of size 0 as a (0.0 KiloBytes/sec) (average 0.0
KiloBytes/sec)

服务器:
[[email protected]
node1]# ll
total 4
-rw-r–r– 1 root  root      0 May 27 11:33 a
-rwxr–r– 1 samba sherry 1277 May 27 11:38 anaconda-ks.cfg

客户端 挂载到本地:
[[email protected]
samba]# yum install cifs-utils -y

[[email protected]
samba]# mount -t cifs //sherry/node1 /mnt/samba/node1/ -o
username=samba  # username=samba,passwd=222222
 Password: 
 
[[email protected]
node1]# df -h
Filesystem              Size  Used Avail Use% Mounted on
…….
//sherry/node1          1004M  18M  936M  2% /mnt/samba/node1

over

————————————分割线————————————

如何在Ubuntu 14.04中使用Samba共享文件 

VMWare 虚拟机 Ubuntu 双网卡 访问 samba 速度 翻倍

Samba文件共享服务器加入Windows Server 2003域

Samba安装配置

CentOS 6.2 下Samba 服务的配置

Samba服务器安装和配置 

Win7+VMware+Fedora18 Samba服务器的搭建图解

————————————分割线————————————

Samba 的详细介绍:请点这里
Samba 的下载地址:请点这里

本文永久更新链接地址:

作为服务器端实现: smb:service
message block ----progress:smbd port:445/tcp netbios:本地名称解析
--------progress:n…

相关文章