bash 在 OSX 10.12 / Sierra 中使用终端安装网络驱动器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/40850522/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 15:28:28  来源:igfitidea点击:

Mounting network drives with Terminal in OSX 10.12 / Sierra

bashmacosterminalmountmacos-sierra

提问by Polle

I just updated to OSX 10.12 / Sierra. Usually when I reboot my computer, I run the following in a script to mount my network drives:

我刚刚更新到 OSX 10.12 / Sierra。通常,当我重新启动计算机时,我会在脚本中运行以下命令来安装我的网络驱动器:

mount -t afp afp://user:[email protected]/SKYDEDAGE /Volumes/SKYDEDAGE2015

This has always worked. However after updating to OSX 10.12 / Sierra, this command no longer works. In the script I run, Prior to using the mount command, I make a directory/mountpoint in 'Volumes'. The command still doesn't work, even though the directory/mountpoint exists.

这一直有效。但是,更新到 OSX 10.12 / Sierra 后,此命令不再有效。在我运行的脚本中,在使用 mount 命令之前,我在“Volumes”中创建了一个目录/挂载点。即使目录/挂载点存在,该命令仍然不起作用。

I get this error code:

我收到此错误代码:

mount_afp: AFPMountURL returned error 1, errno is 1

Any ideas why this aren't working anymore?

任何想法为什么这不再起作用?

回答by Christian

Just in case anyone else stumbles over this question and needs a solution, in OS X 10.12, you can use "open":

以防万一其他人遇到这个问题并需要解决方案,在 OS X 10.12 中,您可以使用“打开”:

open smb://<user>:<password>@server/<Volume>

The extra step with creating the folder in /Volumes can be omitted

可以省略在 /Volumes 中创建文件夹的额外步骤

回答by user253010

this worked for me:

这对我有用:

mount -t smbfs //[email protected]/SKYDEDAGE   /Volumes/SKYDEDAGE2015

I prefer to enter passwords manually

我更喜欢手动输入密码

macOS Sierra 10.12.6

macOS Sierra 10.12.6

回答by screaming drills

This is probably because around Sierra, Apple changed /Volumes so that it was no longer globally readable or writeable.

这可能是因为在 Sierra 周围,Apple 更改了 /Volumes,使其不再全局可读或可写。

You have to create a mount folder with sudo, and mount with sudo:

你必须用 sudo 创建一个挂载文件夹,然后用 sudo 挂载:

sudo mkdir -p /Volumes/mount && sudo mount -t AFP afp://user:[email protected]/mount /Volumes/mount

You can also use:

您还可以使用:

open smb://<user>:<password>@server/<Volume>

But that will prompt the user, so won't work in in a startup script.

但这会提示用户,因此不会在启动脚本中工作。