如何在 Mac OS X 上从终端启用用户帐户 SMB 共享?
我正在尝试从终端启用帐户共享。我不知道该怎么做。
这将在我当前正在编程的应用程序内部使用。应用程序创建一个隐藏用户,然后应为此用户启用 SMB 共享。稍后,我需要使用 SMB 通过另一台服务器连接到此共享。
我需要相同的效果,就像进入系统偏好设置 → 共享 → 文件共享 → 启用任何帐户使用 SMB 进行共享。
我已有的:
- 知道如何创建隐藏用户
- 我已经 知道如何创建单独的共享文件夹,但不知道帐户共享。
我已经尝试过的:
- 我已经尝试扫描系统以查找上次修改的文件,以在 Samba 配置文件中查找一些信息,但没有帮助。
我不需要什么:
- 我无法使用 SSH 执行此操作。这些文件夹需要通过 SMB 共享。
I'm trying to enable Account Sharing from terminal. I can't figure out how to do that.
This will be used from inside an application I'm currently programming. The application creates a hidden user, then should enable SMB sharing for this user. Later, I need to connect to this share via another server using SMB.
I need the same effect as going to System Preferences → Sharing → File Sharing → enable any account for sharing using SMB.
What I already have:
- I know how to create a hidden user
- I already know how to create individual shared folders, but not account sharing.
What I've already tried:
- I already tried to scan the system for last modified files to find some information in Samba config files, but it didn't help.
What I don't need:
- I can't do this with SSH. The folders need to be shared via SMB.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这适用于 OS X 10.5、10.6、10.7
首先在终端中输入
SomeUser
也可以隐藏,没关系。这与启用该复选框具有相同的效果,如上图所示。之后:
当它要求输入密码时,这会产生与从系统偏好设置中启用它相同的效果。这和填写密码是一样的。
如果您想在该帐户上禁用 SMB(
SomeUser
可以再次隐藏):PS 在 Mac OS X Lion 中,他们更改了 SMB (SMBX) 的实现。但请注意,它仍然使用相同的共享点机制来创建共享,并且由目录服务负责。此外,它仍然以相同的方式在帐户上启用 SMB!
THIS WORKS FOR OS X 10.5, 10.6, 10.7
First type this in terminal
SomeUser
can also be hidden, it doesn't matter. This gives the same effect like enabling that checkbox as shown in the picture above.After that:
This gives the same effect, as enabling it from System Preferences, when it asks for a password. It's the same like filling in that password.
If you want to disable SMB on that account (
SomeUser
can be hidden again):P.S. In Mac OS X Lion, they changed their implementation for SMB (SMBX). But be aware that it still uses the same Share Points mechanism for creating a share, and Directory Service is responsible for it. Also it still works the same way for enabling SMB on account!
我已经在 10.7 中尝试了上面的答案,我很高兴看到在 SMB-NT 打开后,该设置有效地出现在“共享选项”屏幕中。
问题是,由于该用户启用了该方法,我无法从 Windows 进行连接。所以我不得不尝试我之前找到的另一个深奥的解决方案,但我不想尝试:
这是完整的解释:
https://discussions.apple.com/thread/3211072?start=0& ;tstart=0
进行更改后,用户 smb 设置再次关闭(可能是因为我使用了 .plist 旧文件),但我能够有效地将其打开并从 Windows 连接!
I've tried the answer above in 10.7 and I was happy to see that after the SMB-NT on, the setting appeared effectively on in the Sharing Options screen.
The problem is that being that user enabled with that method I could not connect from Windows. So I had to try another esoteric solution that I had found before and I didn't want to try:
Here is the full explanation:
https://discussions.apple.com/thread/3211072?start=0&tstart=0
After making that change, the user smb setting was again OFF (maybe because I used a .plist old file), but I was able to effectively turn it ON and to connect from Windows!
这可能是另一种方式。
要再次禁用它, - 卸载它。
This could be one other way.
And to disable it again, - unload it.