Re: Copy file to remote PC



On Apr 10, 1:26 am, "Willy Denoyette [MVP]"
<willy.denoye...@xxxxxxxxxx> wrote:
<alexia....@xxxxxxxxx> wrote in message

news:808af84f-c81b-46b8-9c59-7e587412b6fc@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I am afraid that file.copy or permission access is good for copying
file manually. it is not the same
if copying file prorammatically.

I saw there is a function called UserLogOm() but it is not good for
RPC in the domain.

Don't know what RPC has to do with this.
You need to run your program in a domain account with appropriate privileges
to access the remote share.
In your program all you need to do is specify the UNC path of the remote
file, something like this:
File.Copy("localfile", @"\\servername\sharename\dir\dir\file");

If you don't run in a domain account, you will have to create a logon
session (LogonUser() ) and impersonate a domain account.
Another viable option is to create a session with the remote server/share
using the "net use ..." command line utility.

For instance when you issue following command (from the command line or by
code):

net use \\remServer\someShare myDomainPwd /user:myDomain\myDomainAccount

you will be able to copy a local file to the remote share like this:

..
File.Copy("somefile.txt", @"\\remServer\someShare\someremotefile.txt");
...

Willy.

Hi all and thanks for the reply.

What is exactly the "sharenane"? is it the user name?
if I don't use "net use", where do i put username and password (and
domain if any) in the string when I copy the file?

thanks.
.



Relevant Pages

  • Re: Copy file to remote PC
    ... You need to run your program in a domain account with appropriate privileges to access the remote share. ... If you don't run in a domain account, you will have to create a logon session ) and impersonate a domain account. ... For instance when you issue following command: ...
    (microsoft.public.dotnet.languages.csharp)
  • [UNIX] GNU Mailutils Multiple Vulnerabilities (Buffer Overflows, Format String, DoS)
    ... execute arbitrary code from remote using the GNU Mailutils programs. ... Remote exploitation of a format string vulnerability in the imap4d server ... The vulnerability specifically exists in the handling of the command tag ...
    (Securiteam)
  • RV: remote tape with ontape (dd command) fail after openssh install
    ... I solved the permission denied of root remote command adding remote host to ... The source of problem has to do with the post installation openssh. ...
    (comp.databases.informix)
  • temporary fix for Windows rebooting with RPC message
    ... A possible temporary fix for the rebooting Windows machine with the RPC ... Remote Access Auto Connection Manager ... First select the Remote Access Connection Manager with the secondary ...
    (microsoft.public.windowsxp.security_admin)
  • Re: who flags on OSR5
    ... logged in user with command: ... On a box with about 220 users, all but 5 remote in terms of being not within ... Checking a few other smaller boxes shows almost the same thing. ... Sometimes my own ssh session shows up, sometimes nothing at all is retruned ...
    (comp.unix.sco.misc)