差異處
這裏顯示兩個版本的差異處。
下次修改 | 前次修改 | ||
samba [2017/01/04 00:03] 127.0.0.1 建立 |
samba [2023/06/11 00:58] (目前版本) jz |
||
---|---|---|---|
行 1: | 行 1: | ||
- | |||
====== samba ====== | ====== samba ====== | ||
+ | |||
+ | ====== install ====== | ||
<code> | <code> | ||
- | pkg install samba36 | + | pkg install samba42 |
+ | sysrc samba_server_enable="YES" | ||
</code> | </code> | ||
+ | |||
+ | ====== config ====== | ||
+ | /usr/local/etc/smb4.conf | ||
+ | <code> | ||
+ | [global] | ||
+ | workgroup = WORKGROUP | ||
+ | server string = CSNA Server | ||
+ | netbios name = csna | ||
+ | wins support = Yes | ||
+ | security = user | ||
+ | passdb backend = tdbsam | ||
+ | |||
+ | [public] | ||
+ | path = /home/public | ||
+ | writable = yes | ||
+ | browsable = yes | ||
+ | read only = no | ||
+ | guest ok = yes | ||
+ | create mask = 0644 | ||
+ | directory mask = 0755 | ||
+ | hosts allow = 140.116.0.0/255.255.0.0 | ||
+ | |||
+ | [homes] | ||
+ | path = /home/%U | ||
+ | writable = yes | ||
+ | browsable = yes | ||
+ | read only = no | ||
+ | guest ok = no | ||
+ | create mask = 0644 | ||
+ | directory mask = 0755 | ||
+ | hosts allow = 140.116.0.0/255.255.0.0 | ||
+ | </code> | ||
+ | |||
+ | ====== public share ====== | ||
+ | user has all permission on his/her own file, but can not delete others. | ||
+ | <code> | ||
+ | mkdir /home/public | ||
+ | chmod 3777 /home/public | ||
+ | </code> | ||
+ | |||
+ | ====== start service ====== | ||
+ | <code> | ||
+ | service samba_server start | ||
+ | </code> | ||
+ | |||
+ | ====== add samba user account ====== | ||
+ | <code> | ||
+ | smbpasswd -a CSNA2016 | ||
+ | </code> | ||
+ | |||
+ | ====== mount ====== | ||
+ | <code> | ||
+ | sudo mount -t cifs -o vers=3.0,username=${USER},password=${PASSWORD},uid=$(id -u),gid=$(id -g) //server-address/folder /mount/path/on/ubuntu | ||
+ | sudo mount -t cifs -o vers=3.0,username=${USER},password=${PASSWORD},uid=$(id -u),gid=$(id -g),forceuid,forcegid, //server-address/folder /mount/path/on/ubuntu | ||
+ | </code> | ||
+ | |||
+ | ====== List shares ====== | ||
+ | <code> | ||
+ | smbclient -L ip_of_net_interface -U your_user_name | ||
+ | </code> | ||
+ | |||
+ |