?
Solved

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

Posted on 2014-02-12
7
Medium Priority
?
407 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 20

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 20

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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 20

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 20

Accepted Solution

by:
strivoli earned 2000 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.
Suggested Courses

864 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