【发布时间】: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