Debian 7下配置samba和Windows8共享

http://blog.csdn.net/joogle/article/details/17475611

  1. apt-get install samba 安裝samba

  2. smbpasswd -a infly增加共享用的用戶infly,按照提示輸入密碼

     

  3. vi /etc/samba/smb.conf 編輯配置

    3.1 去掉security = user前邊的註釋

    3.2 增加

         [debian]

    path = /opt/share

    valid users = infly

    public = no

    writable = yes

    read only = no

     

      4.  重啓samba

            /etc/init.d/samba restart

      

      寫配置文件時候可以用testparm命令檢查配置文件語法是否正確

      注:infly已經是我debian系統中的一個用戶名。若smbpasswd -a test,增加samba用戶不是系統中的用戶名,會出現提示Failed to add entry for user

[root@debian~]# smbpasswd -a test
New SMB password:
Retype new SMB password:
Failed to add entry for user test.


解決辦法:
這是因爲沒有加相應的系統賬號,所以會提示Failed to add entry for user的錯誤,只需增加相應的系統賬號test就可以了:
[root@debian~]# groupadd test -g 6000
[root@debian~]# useradd test -u 6000 -g 6000 -s /sbin/nologin -d /dev/null


這時就可以用smbpasswd -a test增加test這個samba賬號了!爲了增加系統的安全性,所以加的系統賬號不要給shell它,也不給它指定目錄,到時在/home目錄給test賬號建個文件夾,該文件夾只有test有讀寫權限即可!
如:
[root@debian~]# mkdir /home/test
[root@debian~]# chown -R test:test /home/test


若不想讓另人訪問,只讓test用戶可以訪問,只需執行命令:
[root@debian~]# chmod u+rwx,g+rwx,o-rwx /home/test


這時可以用smbpasswd命令增加samba賬號test了
[root@debian~]# smbpasswd -a test
New SMB password:
Retype new SMB password:
Added user test.


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章