1. 搜尋 Samba Server 套件
# apt-cache search samba | grep ^samba
samba – SMB/CIFS file, print, and login server for Unix
samba-common – common files used by both the Samba server and client
samba-common-bin – Samba common files used by both the server and the client
samba-dbg – Samba debugging symbols
samba-dev – tools for extending Samba
samba-doc – Samba documentation
samba-dsdb-modules – Samba Directory Services Database
samba-libs – Samba core libraries
samba-testsuite – test suite from Samba
samba-vfs-modules – Samba Virtual FileSystem plugins
2. 進行安裝
# apt-get install samba[@more@]3. 進行設定
# vim /etc/samba/smb.conf
# Global parameters
[global]
workgroup = HOME
server role = standalone server
security = USER
map to guest = Bad User
obey pam restrictions = Yes
pam password change = Yes
passwd program = /usr/bin/passwd %u
passwd chat = *Entersnews*spassword:* %nn *Retypesnews*spassword:* %nn *passwordsupdatedssuccessfully* .
unix password sync = Yes
syslog = 0
log file = /var/log/samba/log.%m
max log size = 1000
dns proxy = No
usershare allow guests = Yes
panic action = /usr/share/samba/panic-action %d
idmap config * : backend = tdb
[homes]
comment = Home Directories
valid users = %S
read only = No
create mask = 0700
directory mask = 0700
veto files = /.*/
browseable = No
[printers]
comment = All Printers
path = /var/spool/samba
create mask = 0700
printable = Yes
print ok = Yes
browseable = No
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
4. 測試設定檔
# testparm
Load smb config files from /etc/samba/smb.conf
Processing section “[homes]”
Processing section “[printers]”
Processing section “[print$]”
Loaded services file OK.
Server role: ROLE_STANDALONE
5. 啟動 Samba Server
# /etc/init.d/samba start
[ ok ] Starting nmbd (via systemctl): nmbd.service.
[ ok ] Starting smbd (via systemctl): smbd.service.
[ ok ] Starting samba-ad-dc (via systemctl): samba-ad-dc.service.
6. 檢查 Samba Server 是否有正常啟動
# netstat -an | grep -E ‘:137|:138|:139|:445’
tcp 0 0 0.0.0.0:445 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:139 0.0.0.0:* LISTEN
tcp6 0 0 :::445 :::* LISTEN
tcp6 0 0 :::139 :::* LISTEN
udp 0 0 0.0.0.0:137 0.0.0.0:*
udp 0 0 0.0.0.0:138 0.0.0.0:*