从名称带有空格的服务器挂载SMB共享

5

我想在终端上挂载一个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 中添加它吗? - Atropo
你的主机名怎么会有空格呢?据我了解,这是不可能的。 - themel
@themel 这是一个连接了硬盘的AirPort Extreme。在使用AirPort实用工具进行设置时,它没有抱怨名称中的空格。Finder也能够连接到硬盘,即使有空格。 - Jawap
谢谢您提供如何连接到Samba的方法,但请不要将密码写入Bash中,否则它将以明文形式保存在您的文件历史记录中。 - Marco Sulla
1
%20 对我在 macOS zsh 上起作用了,但它是在资源名称中而不是服务器名称中。mount -t smbfs //me:password@NAS/My%20Backups ~/My\ Backups。奇怪。 - Joshua Pinter
请查看以下两个答案以了解有关编程的内容:这里这里 - Nick Korsakov
1个回答

1

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接