2019年12月24日 星期二

Ubuntu 19.1 安裝 samba 並使用 SMBv2 版本

1. 安裝samba服務
sudo apt-get update

sudo apt-get install samba
2. 修改samba設定檔
nano /etc/samba/smb.conf
[global]

## Browsing/Identification ###

# Change this to the workgroup/NT-domain name your Samba server will part of
   workgroup = WORKGROUP
security = user 
# 最小支援的SMBv2版本
min protocol = SMB2
# server string is the equivalent of the NT Description field
   server string = %h server (Samba, Ubuntu)

#### Networking ####

# The specific set of interfaces / networks to bind to
# This can be either the interface name or an IP address/netmask;
# interface names are normally preferred
;   interfaces = 127.0.0.0/8 eth0
interfaces = 127.0.0.0/8 192.168.0.0/16
# Cap the size of the individual log files (in KiB).
;   max log size = 1000
max log size = 100
#======================= Share Definitions =======================
[root]
   comment = Root Directories
   path = /
   writeable = yes
   browseable = yes
   valid users = root

[www]
   comment = www
   path = /var/www
   writeable = yes
   browseable = yes
   valid users = root

# Un-comment the following (and tweak the other settings below to suit)
# to enable the default home directory shares. This will share each
# user's home directory as \\server\username

並把以下註解掉
;[printers]
;   comment = All Printers
;   browseable = no
;   path = /var/spool/samba
;   printable = yes
;   guest ok = no
;   read only = yes
;   create mask = 0700

# Windows clients look for this share name as a source of downloadable
# printer drivers
;[print$]
;   comment = Printer Drivers
;   path = /var/lib/samba/printers
;   browseable = yes
;   read only = yes
;   guest ok = no
3. 重啟 samba 服務
sudo systemctl restart smbd nmbd
4. 建立 Samba 使用者
sudo smbpasswd -a root
其他相關用法

若有修改設定檔 smb.conf,讓 samba 重新載入設定檔,可以使用以下指令,不需重啟 samba 服務
sudo systemctl reload smbd nmbd
檢查設定檔是否有誤
testparm
查看 samba 連線狀態
sudo smbstatus

沒有留言:

張貼留言