samba for linux

參考自 https://computingforgeeks.com/install-and-configure-samba-server-share-on-ubuntu/

安裝

sudo apt install samba

設定

sudo vim /etc/samba/smb.conf

[Docs]
   path = /home/share
   writable = yes
   guest ok = yes
   # guest only = yes
   create mode = 0777
   directory mode = 0777

[user1]
   path = /home/share/user1
   writable = yes
   guest ok = no
   # guest only = no
   create mode = 0777
   directory mode = 0777
   valid user = @sambashre

使用者權限

sudo mkdir -p /home/share
sudo chgrp sambashare /home/share
sudo useradd user1 -M -d /home/share/user1 -s /usr/sbin/nologin -G sambashare 
sudo mkdir /home/share/user1
sudo chown user1:sambashare /home/share/user1
sudo chmod 2770 /home/share/user1

sudo smbpasswd -a user1
sudo smbpasswd -e user1

sudo systemctl restart smbd nmbd

查詢

pdbedit -Lv  # v for verbose

遇到一台XP不能連, 修改smb.conf裡的global區塊加入 參考自 https://askubuntu.com/questions/1268132/windows-xp-cannot-connect-to-samba-share-linux-server-20-04

server min protocol = NT1
security = user
guest ok = yes 
guest account = XP   # XP名稱隨你爽
map to guest = bad password 
sudo systemctl restart smbd nmbd

windows 清除網芳記錄的帳密, 開始>執行>netplwiz>進階>管理密碼

在netplwiz裡選新增windows認証, 把linux samba server ip填上去, 再輸入user1的帳號密碼.

對於該死的M$的網芳密碼還是清不掉的話, 參考自 https://answers.microsoft.com/zh-hant/windows/forum/all/win-10-pro/5c3af15e-5fde-4c94-a3d6-45ad6b8e9dd9

用系統管理員開CMD, 輸入以下2行.

netsh winsock reset catalog

netsh int ipv4 reset reset.log

發佈留言