2 個 ubuntu 系統之間的 Samba 只能是單向的

2 個 ubuntu 系統之間的 Samba 只能是單向的

我的 samba 配置有問題。

我有一個 ubuntu 系統,我們將其命名為 A,直到最近才有 ubuntu 16.04,現在有 ubuntu 20.04。這台 A 電腦連接到第二台電腦(我們將其命名為 B),使用 ubuntu 18.04,透過 samba(以及其他方式)在這些系統之間複製檔案。

我在每個系統中有幾個資料夾,在 16.04 中一切正常

格式化並過渡到 ubuntu 20.04 後,連接現在只是單向的。更具體地說,B 無法再看到 A 中的任何資料夾。不過,這些資料夾在「檔案」中顯示為共用。另一方面,當從 A 存取 B 中的共用資料夾時,一切正常。我嘗試了一些解決方案,但似乎沒有什麼可以解決我的問題(顯然我在這裡遺漏了一些東西)。

/etc/samba/smb.cfg例如,在我的 samba conf 檔案 ( ) 中,在兩個系統中,我的 [global] 部分都有此內容

   workgroup = WORKGROUP
   client min protocol = NT1
   server min protocol = NT1

這是針對某個問題提出的解決方案。它幫助我在從 B 存取我的共用資料夾時沒有收到實際錯誤,但它實際上並未顯示任何共用資料夾(只有一個空資料夾)。

我的最後一次嘗試是使用來自此的說明地點

(理論上)透過添加以下內容來共享匿名共享:

[Anonymous]

path = /samba/anonymous
browsable = yes
writable = yes
read only = no
force user = nobody

僅在A系統下#======================= Share Definitions =======================

Anonymous當從共用資料夾中的 B 檢視時,這建立了一個名為 的資料夾,但我無法真正存取它。它需要密碼,但不需要任何密碼。既不是 samba,也不是使用者密碼。無論如何,它指向我的系統中不存在的資料夾(我已經嘗試過使用現有的資料夾,沒有任何變化),但如果我必須將其應用於每個共用資料夾,那麼它似乎不太方便。

那麼,有誰知道如何在 2 個 ubuntu 系統之間正確共用某些資料夾嗎?據我所知,兩個系統上都安裝了 samba 和 samba 用戶端。

編輯(在 @Morbious1 提出一些評論請求後):

$testparm -s

Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
Server role: ROLE_STANDALONE

# Global parameters
[global]
    client min protocol = NT1
    log file = /var/log/samba/log.%m
    logging = file
    map to guest = Bad User
    max log size = 1000
    obey pam restrictions = Yes
    pam password change = Yes
    panic action = /usr/share/samba/panic-action %d
    passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
    passwd program = /usr/bin/passwd %u
    server min protocol = NT1
    server role = standalone server
    server string = %h server (Samba, Ubuntu)
    unix password sync = Yes
    usershare allow guests = Yes
    usershare owner only = No
    idmap config * : backend = tdb


[Anonymous]
    force user = nobody
    path = /home/gorfanidis/share_testing
    read only = No


[printers]
    browseable = No
    comment = All Printers
    create mask = 0700
    path = /var/spool/samba
    printable = Yes


[print$]
    comment = Printer Drivers
    path = /var/lib/samba/printers

$net usershare info --long

[python_projects]
path=/home/xxxx/python_projects
comment=
usershare_acl=Everyone:F,
guest_ok=y

[misc_cerberus]
path=/home/xxxx/misc
comment=
usershare_acl=Everyone:F,
guest_ok=y

[EfficientDet]
path=/home/xxxx/python_projects/EfficientDet
comment=
usershare_acl=Everyone:F,
guest_ok=n

[surveillance object detection]
path=/home/xxxx/Datasets/surveillance object detection
comment=
usershare_acl=Everyone:F,
guest_ok=n

答案1

您遵循的方法說明此共用定義允許訪客存取:

[Anonymous]
    force user = nobody
    path = /home/gorfanidis/share_testing
    read only = No

它的作用恰恰相反。

為了使其可供訪客存取並確保不存在 Linux 權限問題,我建議進行以下更改:

[Anonymous]
    force user = gorfanidis
    path = /home/gorfanidis/share_testing
    read only = No
    guest ok = yes

好吧,這似乎有效。但這與使其從檔案(nautilus)自動工作相比是一個倒退。有辦法實現這一點嗎?

如果這是單用戶系統,您可以添加force user = gorfanidis到 smb.conf 的 [global] 部分 - 就在下面工作小組 = 工作小組就是我要放它的地方。然後,它將應用於您創建的所有共享,無論您如何創建它們。

相關內容