English 中文(简体)
获取根接入/ 高级助手和 SMJobBless
原标题:Gaining Root Access w/ Elevated Helper & SMJobBless

我正在做一些事情 需要定期将文件安装到 / 图书馆的文件夹中。

我理解过去我本可以使用其中一种认证方法,但后来在10.7中被折旧。

从我至今所读到的我所理解的:

我应该建立一个助手,该助手以某种方式得到认证,并让该助手执行所有移动任务。我看过一些样本代码,包括一些涉及 XPC 和一个叫做电梯的代码,但我有点困惑。

其中很多似乎都涉及到设置某种客户端/服务器模型, 但我不确定这如何转化成我, 将文件安装到正确的目录中。 大多数例子只是传递字符串 。

我的问题很简单:我怎样才能在程序/图书馆中创建我的文件夹, 并定期向它写入文件, 而只提醒用户使用 OONCE 密码, 不再重复? 我真的不知道该如何处理这个, 似乎没有太多文件了 。

问题回答

You are correct that there isn t much documentation for this. You ll basically write another app, the helper app, which will get installed with SMJobBless(). Not surprisingly, the tricky part here is the code signing. The least obvious part for me was that the SMAuthorizedClients and SMPrivilegedExecutables entries in the info plist files of each app are dependent on the identity/certificate that you used to sign the app with. There is also a trick with the compiler/linker to getting the info plist file compiled into the helper tool, which will be a single executable file, rather than a bundle.

一旦帮助程序启动并运行,你就必须设计一种与它进行沟通的方法,因为这些程序是两个不同的进程。 XPC 是一个选项,也许是最简单的选项。 XPC 通常用于服务器进程, 但这里使用的只是 XPC 的通信侧面。 它基本上通过两个应用程序之间的词典来回传。 为字典创建标准格式 。 我用的是“ action ”, @“ source ”, 以及 3个不同的动作值 : @“ filemove ”, @“filecopy” 和@ makedirectory 。 这些是我的助手应用程序可以做的3件事情, 必要时我可以轻松地添加更多的东西 。

帮助程序将基本上设置 XPC 连接和事件处理器, 并等待连接和命令。 命令将只是一个字典, 这样您就可以检查相应的密钥/ 值, 并做任何事情 。

我可以提供更多细节和代码 如果你需要更多帮助, 但这个问题已经9个月了 所以我不想浪费时间 告诉你细节,你已经知道了。





相关问题
ajax login using httpRequest?

I am trying to develop my login script to give feedback to the user if the login is valid or not. Basically if it isn t correct a div box will show saying its wrong, if its correct it will show its ...

Remotely authenticating client Windows user on demand

Suppose I am writing a server for a particular network protocol. If I know that the client is running on a Windows machine, is it possible for my server to authenticate the Windows user that owns the ...

Role/Permission based forms authorizing/authentication?

While looking into forms authorizing/authentication, I found that it is possible to do role based authorizing by adding an array of roles to a FormsAuthenticationTicket. That way I can write User....

热门标签