一、準備工作
首先更新 software sources, 找到最快的源
lcw@ubuntu:~$ sudo apt-get update
二、安裝samba
lcw@ubuntu:~$ sudo apt-get install samba smbfs samba-common smbclient
三、建立samba配置檔案
1. 儲存現有的配置檔案
lcw@ubuntu:~$ sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
2. 編輯配置檔案
lcw@ubuntu:~$ sudo vim /etc/samba//smb.conf
在smb.conf最後添加
[username]
path=/home/username
available=yes
browseable=yes
public=yes
writable =yes
(注意: 上面的設定中,username 換成你的使用者名, 如果在前面有“#”,需要先把它去掉,path必須是已經建立的路徑)
四、建立samba帳戶
lcw@ubuntu:~$ sudo smbpasswd -a lcw
Lcw換成自己的使用者名
這裡會要求你輸入samba帳戶的密碼
lcw@ubuntu:~$ sudo smbpasswd -a lcw
New SMB password:
Retype new SMB password:
Added user lcw.
lcw@ubuntu:~$
五、重新開機samba伺服器
lcw@ubuntu:~$ sudo /etc/init.d/smbd reload
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service smbd reload
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the reload(8) utility, e.g. reload smbd
lcw@ubuntu:~$
修改過smb.conf 的話要執行一次
lcw@ubuntu:~$ sudo /etc/init.d/smbd restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service smbd restart
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) and then start(8) utilities,
e.g. stop smbd ; start smbd. The restart(8) utility is also available.
smbd stop/waiting
smbd start/running, process 5886
lcw@ubuntu:~$
六、測試
到windows下輸入ubuntu ip試一下
在“我的電腦”或者在“運作”處輸入“\\+ubuntu機器的ip”即可
QQ聯系方式:[email protected]
出處:lcw.cnblogs.com
本文申明:本文版權歸作者和部落格園共有,歡迎轉載,轉載請注明出處.