###### tags: `tutorials` `ubuntu` `linux` `mount` `windows` # Samba 安裝與設定 ## 安裝與設定 ~~~bash= ! $ sudo apt-get install -y samba ~~~ ### 編輯 samba 連線路徑 ~~~bash= ! $ sudo vim /etc/samba/smb.conf ~~~ #### 在文件前端 `Global Setting` 部分新增 ~~~ [global] # ← 這行不用新增 wide links = yes follow symlinks = yes unix extensions = no ~~~ #### 在文件中後段 `Misc` 部分的最後添加 *sendfile()* 以加速檔案傳輸 ~~~ # Use sendfile() to accerlerate download speed use sendfile = yes ~~~ #### 文本末端加入掛載路徑 ~~~ [client_mount_folder_name] comment = {comment} path = {path} browseable = yes read only = no create mask = 777 directory mask = 777 valid users = user1, user2 ~~~ - [client_mount_folder_name]: 在 client 要掛載 server,在 server ip 後的資料夾名稱(也就是 client 要掛載的 ip 為 `\\x.x.x.x\client_mount_folder_name`) - comment: 註解 - path: server 掛載路徑 - browseable: - yes: 讓 client 可以瀏覽 - no: 讓 client 不可瀏覽 - read only: (和 writable 相反,2個只能存在一個) - yes: 掛載唯讀 - no: client 可以寫入 - create mask: 創建新檔案,新檔案的權限 - directory mask: 創建新資料夾,新資料夾的權限 - valid users: 指定可以連入 samba 的使用者 (單一使用者只須輸入使用者名稱,複數使用者用 `,` 分隔) > 假設 server ip 為 *123.456.789* ,samba 設定為 > ``` > [Share] > comment = Share > path = /home/usr/Share > browseable = yes > read only = no > create mask = 777 > directory mask = 777 > ``` > 則是在 client 端連線到 `\\123.456.789\Share`,並且 client 端地其目錄會導向 server 的 `/home/usr/Share` > ### 修改完後測試 ~~~bash= ! $ sudo testparm ~~~ 如果沒問題,就是會出現你的設置 ### 編輯外部 samba 連進的帳號 ~~~bash= ! $ sudo pdbedit -a -u {username} ~~~ - {username}: 建立的使用者名稱 :::warning 一定要建立,且建立的使用者必須是 server 上已存在使用者 ::: ### 重啟 samba ~~~bash= ! $ sudo service smbd restart ~~~ --- {%hackmd @jimmy801/win_con_samba %}
×
Sign in
Email
Password
Forgot password
or
Sign in via Google
Sign in via Facebook
Sign in via X(Twitter)
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
Continue with a different method
New to HackMD?
Sign up
By signing in, you agree to our
terms of service
.