# docker快速建立FTP+SAMBA

## **簡易伺服器架設pureFTP**

[**https://github.com/stilliard/docker-pure-ftpd**](https://github.com/stilliard/docker-pure-ftpd)

### **快速建立指令:**

**docker run -d --name ftpd\_server -v /docker/FTP:/etc/pure-ftpd/passwd -v /docker/FTP:/home/ftpusers -p 2121:21 -p 30000-30009:30000-30009 -e "PUBLICHOST=localhost" stilliard/pure-ftpd:hardened**<br>

**進入console**

**pure-pw useradd kawsing -f /etc/pure-ftpd/passwd/pureftpd.passwd -m -u ftpuser -d /home/ftpusers/kawsing**

![](https://lh3.googleusercontent.com/oXkjGdYFhpRVduTEAHGh3jUFHHdwHCXT8Wch0oIH99ZANsYLZ3zjZ9rKhkyXqqjaA0DCQziw09lpCBABgu9cVt5BdnXzGkip7Nio6v_LWUXQV8pp5XQ8M4tpncqAwDJicCxahdEB)

**使用 filezilla 測試**

![](https://lh3.googleusercontent.com/yXMJQgQqPn15Yepx5t2oJFwfkyHwuZ6cbJmvCkQ2YFtTzW6ls6iY0342M4b_oa7K8FhMqB7H_YQ4iFfdC9IX_Uig82TQ-p7jeoGMtbyC3LNiPxZo6MNRd7Y4Ku3cU5kxwIPCJrlS)

**指令傳檔**

**curl -T 檔案 ftp\://localhost --user kawsing:password**<br>

**瀏覽器檢視**

![](https://lh6.googleusercontent.com/eF4f5WFspEOHETNlXDA3d4GrSVGYHyNhXz_EUq7rMNXfu2I7ZXPWsLHQWZ5dQKWhwn7fKhazhQ0OemqZX2tD5-8_EcllQ-rTwY6AjVyozpSJWtsc8Ml0Dljh--LmZXYBMqHrTlXy)

## 架設SAMBA

### 快速架設測試

```
sudo docker run -it -p 139:139 -p 445:445 -v /tmp:/share -d dperson/samba -s "public;/share"
```

說明：

* 通過docker的`-v`命令，把宿主機的`/tmp`目錄映射到日容器的`/share`目錄。
* 通過samba的`-s`命令，把`/share`目錄以`public`名稱共享出來。

![](/files/-LkwOE2mvexhwDKKgSNa)

### `使用 -s`命令的格式 <a href="#s-ming-ling-de-ge-shi" id="s-ming-ling-de-ge-shi"></a>

-s "\<name;/path>\[;browse;readonly;guest;users;admins;writelist;comment]"

### 加入使用者認證

```
sudo docker run -it --name samba -p 139:139 -p 445:445 -v /tmp:/share -d dperson/samba -u "kawsing;pass" -s "public;/share;yes;no;no;kawsing;kawsing;;說明"
```

```
容器中smb.conf的部分設定
[public]
   path = /share
   browsable = yes
   read only = no
   guest ok = no
   veto files = /._*/.apdisk/.AppleDouble/.DS_Store/.TemporaryItems/.Trashes/desktop.ini/ehthumbs.db/Network Trash Folder/Temporary Items/Thumbs.db/
   delete veto files = yes
   valid users = kawsing
   admin users = kawsing
   comment = 說明
```

更多的說明可以參考 <https://github.com/dperson/samba>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kawsing.gitbook.io/opensystem/docker-cong-an-zhuang-dao-ying-yong-ru-men-pian/docekr-pureftp-fu-wu.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
