【问题标题】:Mount SMB share from a server with a space in its name [closed]从名称中带有空格的服务器挂载 SMB 共享 [关闭]
【发布时间】:2013-03-28 03:45:03
【问题描述】:

我正在尝试在终端上安装 SMB 共享。如果服务器名称中没有空格,我可以这样做:

$ mount -t smbfs //user:password@server/resource /Volumes/resource

但是在我的情况下,服务器名称有一个空格,我不知道如何正确传递这样的名称。

我尝试使用双引号或单引号:

$ mount -t smbfs "//user:password@ser ver/resource" /Volumes/resource
mount_smbfs: URL parsing failed, please correct the URL and try again: Invalid argument

我试图逃离空间:

$ mount -t smbfs //user:password@ser\ ver/resource /Volumes/resource
mount_smbfs: URL parsing failed, please correct the URL and try again: Invalid argument

我也尝试使用%20\x20\040,但出现错误:

mount_smbfs: server connection failed: No route to host

我知道我可以使用 IP 地址或重命名服务器,但这是一种解决方法,而不是解决方案,我想知道我缺少什么。

【问题讨论】:

  • 你能把它添加到你的fstab吗?
  • 您是如何得到一个包含空格的主机名的?据我了解,这是不可能的。
  • @themel 这是一个带有 HDD 的 AirPort Extreme。在使用 AirPort Utility 进行设置时,它并没有抱怨其名称中的空格。 Finder 也可以连接到硬盘,即使有空间。
  • 感谢您如何连接到samba,但请不要将密码写入bash,它将清楚地保存在您的文件历史记录中。
  • %20 在 macOS zsh 上为我工作,但它在资源名称中,而不是在服务器名称中。 mount -t smbfs //me:password@NAS/My%20Backups ~/My\ Backups。奇怪。

标签: bash shell escaping mount smb


【解决方案1】:

如果将引号和转义结合起来会发生什么:

mount -t smbfs "//user:password@ser\ ver/resource" /Volumes/resource

据报道,当mounting an smbfs volume with a space in the username 时,这对某人有用。

【讨论】:

    猜你喜欢
    • 2015-03-15
    • 2018-04-10
    • 2015-02-20
    • 2016-05-11
    • 1970-01-01
    • 2014-09-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多