如何:通过身份验证复制网络中的文件? [英] HOW: Copy files in network with authentication ??

查看:55
本文介绍了如何:通过身份验证复制网络中的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




有谁知道如何将网络内的文件从mashine复制到

mashine2

如果mashine2需要用户/通过身份验证?


我在Windows平台上需要这个。

任何人都这样做了吗?


Thaks。

Hi,

Does anyone know how to copy files inside network from mashine one to
mashine2
if the mashine2 requires user/pass authentication ??

I need this for Windows platform.
Anyone did that ?

Thaks.

推荐答案

" Kristijan Marin" < KR ************* @ hermes-plus.si>在消息中写道

新闻:ee ************** @ TK2MSFTNGP10.phx.gbl ...
"Kristijan Marin" <kr*************@hermes-plus.si> wrote in message
news:ee**************@TK2MSFTNGP10.phx.gbl...
有谁知道如何如果mashine2需要用户/通过身份验证,请将网络内的文件从mashine复制到
mashine2


我需要这个用于Windows平台。
Does anyone know how to copy files inside network from mashine one to
mashine2
if the mashine2 requires user/pass authentication ??

I need this for Windows platform.




哪个Windows平台?


如果是你正在谈论的NT / 2K / XP / 2K + 3之一你应该能够
使用此序列


LogonUser();

ImpersonateLoggedOnUser();

CopyFile();

RevertToSelf();

CloseHandle(); //在LogonUser返回的令牌上()

在XP之前,调用线程要求必须在可信计算中

base,也就是说是SE_TCB_NAME特权,它在

用户管理器中显示为作为操作系统的一部分。


因此,此序列为通常在服务器应用程序中找到

,它们被实现为在LocalSystem下运行的服务,具有

必需的权限,并且必须由管理员安装。

问候,




Which Windows platform?

If it is one of NT/2K/XP/2K+3 that you are talking about you should be able
to use this sequence

LogonUser();
ImpersonateLoggedOnUser();
CopyFile();
RevertToSelf();
CloseHandle(); // on the token returned by LogonUser()

Prior to XP, the calling thread requires must be in the trusted computing
base which is to say it is the SE_TCB_NAME privilege which shows up in the
user manager as "Act as part of the operating system".

For that reason, this sequence is usually found in a server applications
which are implemented as services running under LocalSystem, having the
requisite privilege, and necessarily installed by an administrator.

Regards,
Will


William DePalo [MVP VC ++]写道:
William DePalo [MVP VC++] wrote:
有人知道如何将网络内的文件从mashine复制到
mashine2
如果mashine2需要用户/通过身份验证吗?
Does anyone know how to copy files inside network from mashine one to
mashine2
if the mashine2 requires user/pass authentication ??


如果它是你正在谈论的NT / 2K / XP / 2K + 3之一你应该能够使用这个序列

LogonUser();
ImpersonateLoggedOnUser();
CopyFile();
RevertToSelf();
CloseHandle(); //在LogonUser返回的令牌上()

If it is one of NT/2K/XP/2K+3 that you are talking about you should be able
to use this sequence

LogonUser();
ImpersonateLoggedOnUser();
CopyFile();
RevertToSelf();
CloseHandle(); // on the token returned by LogonUser()



LogonUser只会将您登录到本地计算机,并且无法使用

登录到远程计算机。用户必须在本地存在。如果用户

在本地不存在,那么WNetAddConnection似乎是唯一的方式

,这是不安全的,因为如果应用程序崩溃,连接

仍然开放。我还没有找到一个有效且安全的解决方案。

LogonUser完全没有问题,因为在一个典型的网络上,一台

本地计算机只有1个用户,而文件服务器有很多其他的。


Tom



LogonUser only logs you in to the local computer, and it can''t be used
to log on to a remote computer. The user must exist locally. If the user
doesn''t exist locally, than WNetAddConnection seems to be the only way
to go, which is not safe, because if the app crashes, the connection
remains open. I have yet to find a solution that works and is safe.
LogonUser is totally out of question, because on a typical network a
local computer only has 1 user, while a file server has numerous others.

Tom




Tamas Demjen < TD ***** @ yahoo.com>在消息中写道

news:ub ************** @ TK2MSFTNGP12.phx.gbl ...

"Tamas Demjen" <td*****@yahoo.com> wrote in message
news:ub**************@TK2MSFTNGP12.phx.gbl...
William DePalo [MVP VC ++ ]写道:
William DePalo [MVP VC++] wrote:
如果mashine2需要用户,有谁知道如何将网络内的文件从mashine复制到
mashine2
/ pass authentication ??
Does anyone know how to copy files inside network from mashine one to
mashine2
if the mashine2 requires user/pass authentication ??


如果是你正在谈论的NT / 2K / XP / 2K + 3之一你应该
能够使用这个序列

LogonUser();
ImpersonateLoggedOnUser();
CopyFile();
RevertToSelf();
CloseHandle(); //在LogonUser返回的令牌上()
If it is one of NT/2K/XP/2K+3 that you are talking about you should be
able to use this sequence

LogonUser();
ImpersonateLoggedOnUser();
CopyFile();
RevertToSelf();
CloseHandle(); // on the token returned by LogonUser()



LogonUser只会将您登录到本地计算机,它不能用于登录到远程电脑。用户必须在本地存在。如果用户在本地不存在,那么WNetAddConnection似乎是唯一的方法,这是不安全的,因为如果应用程序崩溃,连接仍然打开。我还没有找到一个有效且安全的解决方案。 LogonUser完全没有问题,因为在典型的网络中,本地计算机只有1个用户,而文件服务器则有很多其他用户。

Tom



LogonUser only logs you in to the local computer, and it can''t be used to
log on to a remote computer. The user must exist locally. If the user
doesn''t exist locally, than WNetAddConnection seems to be the only way to
go, which is not safe, because if the app crashes, the connection remains
open. I have yet to find a solution that works and is safe. LogonUser is
totally out of question, because on a typical network a local computer
only has 1 user, while a file server has numerous others.

Tom




LogonUser的目的是获取一个访问令牌,指定有效本地或域(远程)帐户的

凭证。如果您指定了

远程用户凭据,则获取的令牌可用于模拟当前线程并访问远程资源。现在,如果您使用非本地

用户凭据,则对本地FS对象的访问将失败(除非远程

用户是本地帐户的影子帐户),这可以解决方法:

- 在调用LogonUser时指定域用户并授予此doamin

帐户访问loacl FS资源,或者

- 将LOGON32_LOGON_NEW_CREDENTIALS指定为dwLogonType(W2K2或

更高)。


Willy。



The purpose of LogonUser is to obtain an access token specifying the
credentials of a valid local or domain (remote) account. If you specify a
remote users credentials, the token obtained can be used to impersonate the
current thread and access the remote resource. Now, if you use non local
user credentials, accesses to local FS objects will fail (unless the remote
user is a shadow account of a local account), this can be solved by:
- specifying a domain user when calling LogonUser and granting this doamin
account access to the loacl FS resources, or,
- by specifying LOGON32_LOGON_NEW_CREDENTIALS as dwLogonType (W2K2 or
higher).

Willy.


这篇关于如何:通过身份验证复制网络中的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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