Accessing a Shared File (UNC) From a Remote, Non-Trusted Domain With Credentials

后端 未结 10 1172
走了就别回头了
走了就别回头了 2020-11-22 05:12

We\'ve run into an interesting situation that needs solving, and my searches have turned up nill. I therefore appeal to the SO community for help.

The issue is this:

10条回答
  •  不知归路
    2020-11-22 05:47

    AFAIK, you don't need to map the UNC path to a drive letter in order to establish credentials for a server. I regularly used batch scripts like:

    net use \\myserver /user:username password
    
    :: do something with \\myserver\the\file\i\want.xml
    
    net use /delete \\my.server.com
    

    However, any program running on the same account as your program would still be able to access everything that username:password has access to. A possible solution could be to isolate your program in its own local user account (the UNC access is local to the account that called NET USE).

    Note: Using SMB accross domains is not quite a good use of the technology, IMO. If security is that important, the fact that SMB lacks encryption is a bit of a damper all by itself.

提交回复
热议问题