ubuntu samba share 共用 windows linux

來源:互聯網
上載者:User
首先當然是要安裝samba了,呵呵:

代碼:
sudo apt-get install samba
sudo apt-get install smbfs

下面我們來共用群組可讀寫檔案夾,假設你要共用的檔案夾為: /home/ray/share

首先建立這個檔案夾

代碼:
mkdir /home/ray/share
chmod 777 /home/ray/share

備份並編輯smb.conf允許網路使用者訪問

代碼:
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf_backup
sudo gedit /etc/samba/smb.conf

搜尋這一行文字

代碼:
; security = user

用下面這幾行取代

代碼:
security = user
username map = /etc/samba/smbusers

將下列幾行新增到檔案的最後面,假設允許訪問的使用者為:newsfan。而檔案夾的共用名稱為 Share

代碼:
[Share]
comment = Shared Folder with username and password
path = /home/ray/share
public = yes
writable = yes
valid users = newsfan
create mask = 0700
directory mask = 0700
force user = nobody
force group = nogroup
available = yes
browseable = yes

然後順便把這裡改一下,找到[global]把 workgroup = MSHOME 改成

代碼:
workgroup = WORKGROUP
display charset = UTF-8
unix charset = UTF-8
dos charset = cp936


後面的三行是為了防止出現中文目錄亂碼的情況。其中根據你的local,UTF-8 有可能需要改成 cp936。自己看著辦吧。

現在要添加newsfan這個網路訪問帳戶。如果系統中當前沒有這個帳戶,那麼

代碼:
sudo useradd newsfan


要注意,上面只是增加了newsfan這個使用者,卻沒有給使用者賦予本機登入密碼。所以這個使用者將只能從遠端存取,不能從本機登入。而且samba的登入密碼可以和本機登入密碼不一樣。

現在要新增網路使用者的帳號:

代碼:
sudo smbpasswd -a newsfan
sudo gedit /etc/samba/smbusers

在建立立的檔案內加入下面這一行並儲存

代碼:
newsfan = "network username"

如果將來需要更改newsfan的網路訪問密碼,也用這個命令更改

代碼:
sudo smbpasswd -a newsfan

刪除網路使用者的帳號的命令把上面的 -a 改成 -x

代碼:
sudo testparm
sudo /etc/init.d/samba restart


最後退出重新登入或者重新啟動一下機器。
_________________
=================================
Ubuntu 7.04
P4 2.4C | 1G | 120G | NVIDIA MX440
初學乍練,非專業人士。請多指教,謝謝!
http://www.lirui.name

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.