workgroup = workgroup 设置你的工作组名
server string = samba server 设置你的服务器名
hosts allow = 192.168.1. 允许哪些机器访问samba
printcap name = /etc/printcap 设置打印机的配置文件路径
load printers = yes 是否同意共享我的打印机
printing = cups 设置打印机的类型
guest account = pcguest
log file = /var/log/samba/%m.log 日志文件的路径
max log size = 0 设为0表示不对日志文件做限制
sercurity = user 设置安全级别 share/user/server/domain
password server = *
password server =
password level =8
username level =8
encrypt passwords = yes 为你的用户名和密码加个密
smb passwd file = /etc/samba/smbpasswd 设置密码文件的路径
unix password sync =yes 设置samba用户的帐号和linux帐号同步
passwd program = /usr/bin/passwd %u 设置本地口令
passwd chat = *New*password 控制smbd和/usr/bin/passwd之间的会话,用于对密码文件进行改变
pam password change = yes 当用户需求改密码时使用PAM而不用passwd program 所指定的本地口令程序
username map = /etc/samba/smbusers
include = /etc/samba/smb.conf.%m
obey pam restrictions = yes 当认证用户时,服从PAM的管理限制
socket options = TCP_NODELAY 设置服务器和客户之间会话的socket选项
interfaces = 192.168.12.2/24 192.168.13.2/24
remote announce = 192.168.1.255 192.168.2.44
local master = no
os level = 33
domain master = yes
preferred master = yes
domain logons = yes
wins server = w.x.y.z
wins proxy = yes
dns proxy = no 不为客户做dns查询
===================================
share definitions
[homes] 设置每个用户的主目录共享
comment = Home Directories
browseable = no
writable = yes
valid users = %S
create mode = 0664
directory mode = 0775
[Profiles]
path = /usr/local/samba/profiles
browseable = no
guest ok = yes
[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
[tmp]
comment = Temporary file space
path = /tmp
read only = no
public = yes
[public]
comment = Public Stuff
path = /home/samba
public = yes
writable = yes
printable = no
write list = @staff
Other examples.
[fredsprn]
comment = Fred's Printer
valid users = fred
path = /home/fred
printer = freds_printer
public = no
writable = no
printable = yes
[fredsdir]
comment = Fred's Service
path = /usr/somewhere/private
valid users = fred
public = no
writable = yes
printable = no
[pchome]
comment = PC Directories
path = /usr/local/pc/%m
public = no
writable = yes
[public]
path = /usr/somewhere/else/public
public = yes
only guest = yes
writable = yes
printable = no
[myshare]
comment = Mary's and Fred's stuff
path = /usr/somewhere/shared
valid users = mary fred
public = no
writable = yes
printable = no
create mask = 0765
[ritto...]
comment = ritto...
path = /
public = yes
browseable = yes
writable = yes
printable = no
write list = @staff
create mask = 5777
readonly = yes/no
valid users = 访问的人
2. 设置samba帐户:
smbpasswd -a yinhe
或批量设置 cat /etc/passwd | mksmbpasswd.sh > /etc/samba/smbpasswd
smbpasswd yinhe
3. 用vi去掉smbpasswd文件中的一些没有shell的帐号 vi /etc/samba/smbpasswd
4. 设置安全
chown root.root /etc/samba/passwd
chmod 500 /etc/samba 设置目录的权限
chmod 600 /etc/samba/smbpasswd 设置宿主才有读和写的权限
4.启动samba服务器
testparm 检查samba文件的正确性
service smb restart 或 /etc/rc.d/init.d/smb start
5. 查看对方共享了哪些目录
smbclient -L //192.168.10.254
Linux---windows
smbclient -L //192.168.10.254
mount -o username=administrator,password=123456 //192.168.101.254/e /mnt/win
或smbclient //192.168.101.254/e -U yinhe
smbmount //192.168.101.254/e /mnt/win