Chinaunix首页 | 论坛 | 博客
  • 博客访问: 116271
  • 博文数量: 84
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 0
  • 用 户 组: 普通用户
  • 注册时间: 2016-11-17 12:39
个人简介

大连Linux/Unix高端就业、认证培训的领导者。

文章分类

全部博文(84)

文章存档

2013年(25)

2012年(1)

2010年(4)

2009年(9)

2008年(14)

2007年(4)

2006年(27)

分类: LINUX

2009-06-11 11:11:42

修改配置文件
 
[root@linux-zlg home]# cd /etc/samba
[root@linux-zlg samba]# vi smb.conf
^^^^^^^^^^^^^^^^^^^^^^内容如下^^^^^^^^^^^^^^^^^^^^^^
[global]
   workgroup = MYGROUP      建议设置为同windows一样的工作组名如workgroup
   server string = Samba Server    网上邻居访问时备注注信息中可以看到 
;   hosts allow = 192.168.1. 192.168.2. 127.     允许访问的网络或主机地址
   printcap name = /etc/printcap
   load printers = yes                 自动加载打印机列表
   printing = cups                    打印系统名称
;  guest account = pcguest                  如不设,则默认匿名帐号为nobody
   log file = /var/log/samba/%m.log
   max log size = 0                0为不限制,如指定,则单位为KB
  
security = user     安全级别:share/user/server/domain后两种需指定验证的服务器
#  password server = My_PDC_Name [My_BDC_Name] [My_Next_BDC_Name]
# or to auto-locate the domain controller/s
#   password server = *
;   password server =            安全级别的后两种需要的验证服务器
 
   encrypt passwords = yes
   smb passwd file = /etc/samba/smbpasswd
 
   pam password change = yes
 
# Unix users can map to different SMB User names
;  username map = /etc/samba/smbusers     WindowsLinux之间的用户映射文件
;   include = /etc/samba/smb.conf.%m
 
   socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192 定义网络socket 方面的一些参数,能实现更好的文件传输效率。
 
; interfaces = 192.168.12.2/24 192.168.13.2/24   指定samba使用的网络接口,多个网络接口可用
;   local master = no  是否允许nmbd守护进程成为局域网中的主浏览器
#================= Share Definitions ================
[homes]
   comment = Home Directories
   browseable = no
   writable = yes
   valid users = %S  表与共享名同名的用户。如多个用户则空格分开,组群名前加@
   create mode = 0664   设置新文件权限
   directory mode = 0775 设置新目录权限
 
 [printers]      打印共享定义
   comment = All Printers
   path = /var/spool/samba
   browseable = no
# Set public = yes to allow user 'guest account' to print
   guest ok = no
   writable = no
   printable = yes
 
[sharedoc]
 
   comment = share test
   path = /home/sharedoc
;   valid users = mary fred
   public = no
   writable = yes
;   printable = no
;   create mask = 0765
 
[pub]
 
   comment = public folder
   path = /home/pub
   public = yes
   writable = yes
;   printable = no
;   create mask = 0765
^^^^^^^^^^^^^^^^^^^^^内容完毕^^^^^^^^^^^^^^^^^^^^^^^^^^
[root@linux-zlg samba]# service smb restart
[root@linux-zlg samba]# service smb reload    修改了smb.conf后,可用此命令重新载入配置文件
 
[root@linux-zlg root]# smbclient -L localhost    查看本机的共享
added interface ip=192.168.80.10 bcast=192.168.80.255 nmask=255.255.255.0
added interface ip=192.168.0.10 bcast=192.168.0.255 nmask=255.255.255.0
Password:     直接回车
Anonymous login successful
Domain=[MYGROUP] OS=[Unix] Server=[Samba 2.2.7a]
……
==========================================================
建立samba用户
 
当安全级别为用户模式时,需要创建samba用户。
 
1、如需要把user1加入到samba用户中,可用以下命令:
[root@linux-zlg root]# smbadduser user1:user1     后面的user1为在windows中进行访问时输入的用户名,不一定在windows系统中存在。但在linux中的user1用户必须已存在。
ERROR: user1 is already in /etc/samba/smbpasswd SKIPPING...
[root@linux-zlg root]# smbpasswd user1           修改samba用户的口令
 
2、也可使用mksmbpasswd.sh脚本文件一次性把linux系统用户全部加入到samba用户中:
[root@linux-zlg root]# cat /etc/passwd | mksmbpasswd.sh > /etc/samba/smbpasswd
 
其它
 
[root@linux-zlg root]# chkconfig --level 35 smb on   设置开机自动启动服务
[root@linux-zlg root]# smbstatus                                查看当前访问状态
[root@linux-zlg root]# testparm                    检查smb.conf中的语法有无错误
Load smb config files from /etc/samba/smb.conf
[root@linux-zlg root]# testparm /etc/samba/smb.conf lgxh 192.168.80.1  查看允许客户端访问的资源
阅读(1004) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~