#!/bin/bash
#SAMBA window co-connect linux
#SAMBA NETBIOS
#SAMBA nmbd:137 138 smbd:139 445
#samba samba-client samba-common /etc/samba/smb.conf /etc/samba/imhosts/etc/sysconfig/samba /etc/samba/smbusers
#/var/lib/samba/private/passdb.tdb,secrets.tdb
#smbd nmbd tdbdump tdbtool smbstatus smbpasswd pdbedit testparm smbclientnmblookup smbtree
yum install -y samba netbios;
#log file= max log size=rotate...
#security=share(no pass) user(passdb backend=) domain(password server=IP)
#path,browseable,writable,create mode,directory mode,writelist=@
#
配置不用帐号密码的文件夹
cd /etc/samba
cp smb.conf smb.conf.raw
vim /etc/samba/smb.conf
[global]
workgroup = vbirdhouse
netbios name = vbirdserver
server string = This is test
unix charset = utf8
dos charset = cp36
log file = /var/log/samba/log.%m
max log size = 50
security=user
map to guest =Bad User
load printers = no
[temp]
comment = Templrary file space
path = /tmp
writable = yes
browseable = yes
guest ok = yes
##########end smb.conf
testparm -v #test conf
/etc/init.d/smb start
/etc/init.d/nmb start
chkconfig smb on
chkconfig nmb on
###################
客户端
yum install -y cifs*;
smbclient -L //127.0.0.1
mount -t cifs //127.0.0.1/temp /mnt
#####################################
添加有用户名和密码的共享
cd /etc/samba
cp smb.conf smb.conf.raw
vim /etc/samba/smb.conf
[global]
workgroup = vbirdhouse
netbios name = vbirdserver
server string = This is test
unix charset = utf8
dos charset = cp36
log file = /var/log/samba/log.%m
max log size = 50
security=user
passdb backend = tdbsam
load printers = no
[homes]
comment = sxxx
browseable = no
writeable = yes
create mode = 0664
directory mode = 0775
[project]
comment = xxxx
path = /home/project
browseable = yes
writeable = yes
write list = @users
###########
useradd -G users smb1;
useradd -G users smb2;
useradd -G users smb3;
echo 1234|passwd --stdin smb1;
echo 1234|passwd --stdin smb2;
echo 1234|passwd --stdin smb3;
#
往SMDB中添加帐号密码,该帐号密码必须在/etc/passwd
pdbedit -a -u smb1;
pdbedit -a -u smb2;
pdbedit -a -u smb3;
pdbedit -L #list
pdbedit -r -u smb1 #
修改用户信息
pdbedit -x -u smb1 #
删除用户
#
客户端挂载
mount -t cifs //192.168.10.54/smb1 /mnt -o username=smb1
##################printer
lsusb
ll /dev/usb/lp0
echo "xxx"> /dev/usb/lp0
yum groupinstall -y "Print Server";
vim /etc/cups/cups.conf
Listen 0.0.0.0:631
Allow From 192.168.10.0/24
/etc/init.d/cups start
chkconfig cups on
https://ip:631
#smb.conf
加入打印机支持
vim smb.conf
[global]
load printers=yes
cups options = raw
printcap name=cups
printing =cups
[printers]
comment=xx
path=/var/spool/samba
browseable=no
guest ok=no
writeable=no
printable=yes
############################
���c�'