以另一个域上的特定用户身份写入目录 [英] Write to a Directory as a Specific User on a Different Domain

查看:142
本文介绍了以另一个域上的特定用户身份写入目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道,如何将一个文件(例如,从一个计划任务中的控制台应用程序)写入另一个域上的另一台计算机?如何设置用户名和密码,例如登录到...对话框进行身份验证?



有几项先决条件存在,很明显:

>


  • 计算机可以在域中看到对方,但需要进行身份验证

  • 您知道登录信息

  • 您要登录的用户名具有相应的写入权限



任何人都可以想法?
$ b $ p感谢,

凯尔

解决方案

这里的方法是使用模仿。看看这里了解简单的操作方法。

基本上,您需要获取用户标记的句柄(通常使用 LogonUser ),然后调用 Impersonate



还有几个项目(例如这一个 )使这个过程更容易一些。


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

解决方案

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 call Impersonate.

There are also several projects (eg this one) to make the process a little easier.

这篇关于以另一个域上的特定用户身份写入目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆