Tuesday, March 27, 2007

Configure Samba

#cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
#vi /etc/samba/smb.conf

[global]
workgroup = workgroup
server string = Kubuntu Server
hosts allow = 192.168.0. 192.168.10. 127.
security = user
load printers = yes
;guest account = nobody
log file = /var/log/samba.%m
max log size = 50
encrypt passwords = true
null passwords = no
local master = yes
os level = 33
;domain master = yes
;preferred master = yes
;domain logons = yes
;logon script = %G.bat


#============================ Share Definitions ==============================
[programe]
comment = programe
path = /media/hda9/programe
create mask =0640
directory mask = 750
valid users = @xisgo, hades
public = yes
writable = yes
[Music]
comment = music on hda5
path = /media/hda5/Download/programe/Music
available = yes
browseable = yes
public = yes
writable =yes
[programe2]
comment = programe2
path = /media/hda5/Download/programe
create mask =0640
directory mask = 750
valid users = @xisgo, hades
public = yes
writable = yes

#################################################
อย่าลืม #smbpasswd -a user เพื่อสร้าง user เข้าไปใช้งานด้วยล่ะครับ

นี้คือตัวอย่างการเซท Samba เพื่อใช้แชร์โฟล์เดอร์
Reference:
1. sontayamyblog

samba command line
Display current connection
$ smbstatus
Display more/detailed information: จำนวนผู้ใช้งานอยู่ ณ ตอนนี้
$ smbstatus -b
$ smbstatus -v |grep "Mon Jun 10 20:" แสดงผู้ใช้งานอยู่ ณ วันจันทร์ที่ 10 มิ.ย. เวลา 20:* 
$ smbstatus -v |grep "share-hr-gm" |grep "Jun 10 20:"
smbstatus --shares
smbstatus -s |grep "Mon Jun 10 20:"

Display verbose output:
$ smbstatus -v
$ smbstatus -v | grep user     display specific user 
Display only list of shares:
$ smbstatus -s

2. ยอมให้รันไฟล์ .exe เพื่อติดตั้งโปรแกรมได้จากเครื่อง Client โดยการเพิ่มบรรทัดด้านล่างเพิ่มเข้าไป
#--------------------------------update 20170214---------------------------------------------------#
[global]
workgroup = WORKGROUP
#server string = Samba Server %v
server string = %h server (Samba, Ubuntu)
netbios name = share-ubuntu
interfaces = 127.0.0.0/8 10.10.10.0/24 192.168.10.0/24
security = user
bind interfaces only = yes
map to guest = bad user
dns proxy = no
unix charset = UTF-8
log file = /var/log/samba/log.%m
max log size = 50000
passdb backend = tdbsam
obey pam restrictions = yes
unix password sync = yes
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
pam password change = yes
vfs objects = full_audit recycle
full_audit:prefix = %u|%I|%m|%S
full_audit:success = mkdir rename unlink rmdir pwrite
full_audit:failure = none
full_audit:facility = local7
full_audit:priority = NOTICE
########## Enable execute file .exe ##########
acl allow execute always = True

# Enable the recycle bin 
#vfs object = recycle 
recycle: repository = /myfolder /recycle /%U
recycle: touch = Yes
recycle: keeptree = Yes
recycle: versions = Yes
recycle: noversions = * tmp, * temp, * o, * obj, * TMP, TEMP *......
recycle: exclude = * tmp, * temp, * o, * obj, * TMP, TEMP *......
recycle: excludedir = /recycle, /tmp, /tmp, /tmp, /TEMP

#======================= Share Definitions =========================#
[Downloads]
path = /home/user/downloads
browsable =yes
writable = yes
guest ok = yes
read only = no
force user = nobody
create mask = 0777
directory mask = 0777

#--------------------------------------------------------------------------------------------------------#
Ref: execute a exe on a samba share

No comments: