CentOS 6.x Samba 備份

1. 進行備份學生帳號及密碼
# tar cvjfp /Backup/Stu_account.tar.bz2 /etc/passwd /etc/shadow /etc/group /etc/gshadow
2. 學生檔案備份
# tar cvjfp /Backup/Stu.tar.bz2 /etc/samba/smb.conf /home/s0990 /home/s0100 /var/lib/samba/private
3. 資料還原
# tar xvjfp /Backup/Stu.tar.bz2 -C /[@more@]4. 處理 Samba 與 SELinux 之間的安全性設定
# getsebool -a | grep samba
bacula_use_samba –> off
samba_create_home_dirs –> off
samba_domain_controller –> off
samba_enable_home_dirs –> on
samba_export_all_ro –> off
samba_export_all_rw –> off
samba_load_libgfapi –> off
samba_portmapper –> off
samba_run_unconfined –> off
samba_share_fusefs –> off
samba_share_nfs –> off
sanlock_use_samba –> off
use_samba_home_dirs –> off
virt_use_samba –> off
# setsebool -P samba_enable_home_dirs on
# chcon -R -t samba_share_t /home/s0990
# chcon -R -t samba_share_t /home/s0100

5. 防火牆設定
# iptables -A INPUT -s 192.168.1.0/24 -m state –state NEW -m udp -p udp –dport 137 -j ACCEPT
# iptables -A INPUT -s 192.168.1.0/24 -m state –state NEW -m udp -p udp –dport 138 -j ACCEPT
# iptables -A INPUT -s 192.168.1.0/24 -m state –state NEW -m tcp -p tcp –dport 139 -j ACCEPT
# iptables -A INPUT -s 192.168.1.0/24 -m state –state NEW -m tcp -p tcp –dport 445 -j ACCEPT
# iptables -A INPUT -s 192.168.1.0/24 -m state –state NEW -m udp -p udp –dport 445 -j ACCEPT