无法连接到 ubuntu 18.04 上的 samba 共享

无法连接到 ubuntu 18.04 上的 samba 共享

我尝试在 Ubuntu 18.04(在旧机器上运行)上设置 Samba 服务器。我遵循了以下教程: https://linuxize.com/post/hot-to-install-and-configure-samba-on-ubuntu-18.04/

当尝试通过以下方式访问另一台运行 Ubuntu 20.04 的计算机上的 samba 共享时:

$ smbclient //192.168.178.24/josh -U josh

我收到以下错误:

do_connect:连接 192.168.178.24 失败(错误 NT_STATUS_HOST_UNRECHABLE)

当尝试通过 Finder -> 前往 -> “连接到服务器” 连接 macOS Catalina 时:

smb://192.168.178.24/share_smb/josh

我收到错误:

连接服务器“192.168.178.24”时出现问题。该服务器可能不存在或目前不可用。请检查服务器名称或 IP 地址,检查网络连接,然后重试。

评论:

我尝试使用其他几个教程来设置 Samba 共享,但都不起作用。在默认设置下运行它似乎很简单,但对我来说不起作用。

在网上搜索答案时,我 nautilus smb://192.168.178.24 在安装了 samba 的机器(运行 Ubuntu 18.04)上尝试了这个命令。打开了一个窗口,我可以用用户 Josh 登录,然后访问共享目录并拖放文件。

运行时 sudo systemctl status smbd,它还告诉我 samba 已启动并运行

我尝试通过以下方式运行防火墙: sudo ufw disable,但仍然无法连接到 samba 共享。

我可以 ping 通 Ubuntu 18.04 机器,也可以从(其他)Linux 和 macOS 机器通过 ssh 进入这台机器。

在我看来,Samba 正在运行,但有一些东西阻止其他机器访问它。

我希望您能帮助我在 ubuntu 18.04(或一般 Ubuntu)上设置 samba 共享,非常感谢您的帮助!

testparm -s 的输出:

(base) manuel@manuel-MS-7253:~$ testparm -s
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
WARNING: The "syslog" option is deprecated
Processing section "[printers]"
Processing section "[print$]"
Processing section "[users]"
Processing section "[josh]"
Loaded services file OK.
Server role: ROLE_STANDALONE

# Global parameters
[global]
    dns proxy = No
    log file = /var/log/samba/log.%m
    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 role = standalone server
    server string = %h server (Samba, Ubuntu)
    syslog = 0
    unix password sync = Yes
    usershare allow guests = Yes
    idmap config * : backend = tdb


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


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


[users]
    force create mode = 0660
    force directory mode = 02770
    path = /samba/users
    read only = No
    valid users = @sambashare @sadmin


[josh]
    force create mode = 0660
    force directory mode = 02770
    path = /samba/josh
    read only = No
    valid users = josh @sadmin

smbclient //192.168.178.24/josh -U josh -d3 的输出:

(base) manuel@manuel-mbair:~$ smbclient //192.168.178.24/josh -U josh -d3
lp_load_ex: refreshing parameters
Initialising global parameters
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[global]"
added interface wlp3s0 ip=2001:16b8:46f6:dc00:4bd:1683:395f:cf7e bcast= netmask=ffff:ffff:ffff:ffff::
added interface wlp3s0 ip=2001:16b8:46f6:dc00:4cae:49b9:a843:1d3c bcast= netmask=ffff:ffff:ffff:ffff::
added interface wlp3s0 ip=192.168.178.25 bcast=192.168.178.255 netmask=255.255.255.0
Client started (version 4.11.6-Ubuntu).
Connecting to 192.168.178.24 at port 445
Connecting to 192.168.178.24 at port 139
do_connect: Connection to 192.168.178.24 failed (Error NT_STATUS_HOST_UNREACHABLE)

打字时

$ sudo ufw allow 'Samba'

我收到以下消息: 跳过添加现有规则 跳过添加现有规则 (v6)

相关内容