作为不同域上的特定用户写入目录
我想知道,如何将文件(例如,从计划任务中的控制台应用程序)写入不同域中的另一台计算机?如何设置用户名和密码,例如使用“登录到...”对话框进行身份验证?
显然,存在几个先决条件:
- 计算机可以跨域相互查看,但是它们需要进行身份验证
- 您知道登录详细信息
- 您登录时使用的用户名具有适当的写入权限
有人知道吗?
谢谢,
凯尔
I am wondering, how would one write a file (say for instance, from a Console Application in a scheduled task) to another computer on a different domain? How would one set the Username and Password, such as with the "Log on to..." dialog to authenticate?
Couple of prerequisites exist, obviously:
- The machines can see each other across the domains, however they need to authenticate
- You know the login details
- The username you would log in with has the appropriate permissions to write
Anyone have any idea?
Thanks,
Kyle
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里的方法是使用 冒充。请查看此处,了解简单的操作方法。
本质上,您需要获取用户令牌的句柄(通常使用
LogonUser
),然后调用冒充
。还有几个项目(例如 这个)可以使该过程稍微简单一些更轻松。
The approach here is to use Impersonation. Have a look here for a straightforward how-to.
Essentially, you need to obtain a handle to the user token (usually using
LogonUser
), and then callImpersonate
.There are also several projects (eg this one) to make the process a little easier.