您好社區,我正在修復Windows中的共享文件夾服務器之一,該共享文件夾服務器由於病毒問題而崩潰了。
為了解決這個問題,我將samba設置為文件服務器和域的成員。 這是我遵循的過程,非常適合我的需求。
Samba作為Ubuntu 14.04中的文件服務器
要執行的步驟如下
- 安裝和配置ntp
sudo apt install ntp
- 使用以下數據編輯ntp.conf:
sudo nano /etc/ntp.conf
################################### driftfile /var/lib/ntp/ntp.drift statistics loopstats peerstats clockstats filegen loopstats文件loopstats類型day enable filegen peerstats file peerstats type day enable filegen clockstats file clockstats type day enable server miserverntp.mydomain.cu限制-4默認kod notrap nomodify nopeer限制-6默認kod notrap nomodify nopeer限制127.0.0.1限制: :1限制192.168.1.0掩碼255.255.255.0 nomodify notrap廣播172.16.1.224廣播192.168.1.255 tos孤立服務器127.127.1.0軟糖127.127.1.0層8 ################ ##########################
- 創建腳本以與公共ntp同步
sudo nano ntp.sh
腳本中要包含的數據如下:
#######################################!/ bin / bash sudo服務ntp stop sudo ntp -gq sudo服務ntp start ########################################## ####
- 接下來,我們創建一個任務以定期運行同步:
sudo nano /etc/crontab
########################################## 20 0 * * * root /home/ladmin/ntp.sh ######################################### ##
- 讓我們驗證系統時間是否正確
date
- 我們使用以下數據編輯samba配置
sudo nano /etc/samba/smb.conf
############################################和文件夾沒有引號,但我還沒有找到獲取#brackets的方法:-p“ [global]” netbios名稱= data1工作組=域名安全= ADS領域= SAMBA.DOMINIO.CU加密密碼=是idmap配置*:後端=擺脫idmap配置*:範圍= 100000-200000 winbind使用默認域=是winbind枚舉用戶=是winbind枚舉組=是vfs對象= acl_xattr映射acl繼承=是存儲兩個屬性=是日誌級別= 1日誌文件= /var/log/samba/samba.log“ [文件夾]”註釋=文件夾路徑= / home / samba /可瀏覽的文件夾=是只讀=否強制創建模式= 0660強制目錄模式= 0660 vfs對象= acl_xattr full_audit full_audit :前綴=%u |%I |%S full_audit:設施= local7 full_audit:成功= mkdir重命名取消鏈接rmdir pwrite open full_audit:失敗=無full_audit:優先級=注意############### ## ##############################
- 然後,您必須加入域
net ads join -U usuario_admin_de_dominio
- 要檢查域是否已成功加入,我們使用以下兩個命令
wbinfo -u getent passwd
- 相應的samba文件夾已創建
mkdir /home/samba/
創建我們將視為共享資源的文件夾
mkdir /home/samba/carpeta
- 就我而言,我使用777在samba中設置了權限,您應該記住,在某些情況下,這存在安全風險,因此此步驟是可選的
chmod 777 -R /home/samba
- 我們繼續安裝windbind和cifs-utils
sudo apt install libnss-winbind cifs-utils
- 編輯檔案
/etc/nsswitch.conf
並添加(替換)
passwd:compat winbind組:compat winbind
- 我們重啟電腦
好吧,就目前我們已經可以使用服務器了,我們可以在同一窗口中創建文件夾並修改權限。
希望對您有幫助,任何問題或建議都會被接受。
記住,總是攻擊思想而不是人。
來自哈瓦那的問候
您好,教程非常好,請問,您是否有在 Centos 7 中執行相同操作必須遵循的步驟?
從已經非常感謝你了!
ATTE。
弗雷德里克。
我只在 Debian 7 和 Ubuntu 14.04 上使用過它。 不過我想在Centos中應該不會很難