Solved

What user is used by SQL server when connecting to remote file

Posted on 2014-02-12
7
387 Views
Last Modified: 2014-02-12
I'm running this SQL code
CREATE ASSEMBLY dlls
/*FROM '\\192.168.50.17\SQL-dll\SQL-dll.dll'*/
FROM 'c:\temp\SQL-dll.dll'
GO

Open in new window

This code is run on 192.168.50.17, in SSMS remotely connected to the SQL server. It expects the dll file to be at c:\temp at the SQL server (WinWebServer2008), and it works.
However, I would like to connect to the file that is located on 192.168.50.17 (developer machine), but this does not work. Probably because there's not sufficient user rights from SQL Server to access the file system on 192.168.50.17.
Which user is SQL server using here? It is not the same user as I am connecting the SQL session with, because that user has access to the shared folder on 192.168.50.17.
Alternatively, how can I figure out which user is trying to connect to the shared folder on 192.168.50.17 (Win7)
0
Comment
Question by:lefodnes
  • 4
  • 3
7 Comments
 
LVL 19

Expert Comment

by:strivoli
ID: 39853051
The account usually involved is the (local)SYSTEM or the account invoked to start SQL's service.
In order to be sure which account is used and is access denied to the computer and/or share, set the auditing on the share/folder and have a look at the Windows Security Logs.
0
 

Author Comment

by:lefodnes
ID: 39853212
Thanks strivoli. You helped me a little on the way.

I configured auditing for all users, and I watched it while running the same query from either dev machine or the server.

When running from the server SSMS, it connects from the SQL server as my user name (I'm logged in on it), and then it works (using the \\192.168.50.17\SQL-dll\SQL-dll.dll file path).

When running from the dev machine, it connects from the SQL server as "NT-AUTHORITY\Anonymous". Even if I grant Anonymous rights to the folder on the DEV machine, it cannot read the file. Why is it different? Isn't the same SQL processed, no matter where SSMS is connected from?

Is the anonymous on my dev machine not the same as anonymous on the SQL server machine?
0
 
LVL 19

Expert Comment

by:strivoli
ID: 39853285
I'll send you an official MS link that shows you how to allow anonymous access to a folder. Shortly:
a. Need to allow anonymous at the File System level,
b. Need to allow anonymous at the share level,
c. Need to allow the share to be accessed anonymously.
Will be more precise when I'll send you the full link (don't have it handy and can't find it on the net right now).

Anyway, I don't remember I had to set anonymous access when I faced same problem.

Are the 2 servers members of the same domain?
0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 
LVL 19

Expert Comment

by:strivoli
ID: 39853301
I didn't respond to your questions: anonymous is the same independently from the computer it tries to access from. Your anonymous rights aren't enough. This is why I'll send you full details.
0
 

Author Comment

by:lefodnes
ID: 39853447
thanks a lot for your answers. the two different machines are not on the same domain, nor on the same lan.
looking forward to see your link about this issue.thanks again.
0
 
LVL 19

Accepted Solution

by:
strivoli earned 500 total points
ID: 39853606
Creating an anonymous share in Windows Server 2008R2 is the link I was talking about. I remembered it was an official MS link but it isn't. I've used the instructions on the link to create an anonymous access to a folder on one of my servers.
Consider carefully the security implications of creating anonymous shares.
0
 

Author Closing Comment

by:lefodnes
ID: 39853708
Super! That trick did it :)
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
While working, an annoying popup showing below will come and we cannot cancel or close it form the screen. The error message will come again and again.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question