Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which permissions does the local service account have, by default, when accessing an un-configured database in SQL Express 2008?

I have an SQL Express 2008 R2 instance running under the "Local System" account. I have written a windows service that also runs under the "Local System" account. The windows service uses the following connection string to connect to the sql server.

Data Source=.\sqlexpress;Initial Catalog=mydatabase;Integrated Security=True

When the application is installed I create the database with a simple SQL script which does not set any permissions or roles...it just creates the database and tables.

How does my windows service running as "Local System" manage to access the database? What rights is it getting in the SQL database? How is it getting these rights?

Andrew

like image 360
Andrew Jones Avatar asked Oct 26 '25 09:10

Andrew Jones


1 Answers

If you expand the tree on the left (Object Explorer) in SSMS to Security, then Logins, you will see "NT AUTHORITY\SYSTEM". By default provisioning after installing SQL Server 2008 R2 Express, this account is added to the sysadmin role.

FYI - Your service running as Local System + Integrated Security means it is authenticating with SQL Server as the Windows account NT AUTHORITY\SYSTEM.

http://msdn.microsoft.com/en-us/library/ms188659.aspx

sysadmin Members of the sysadmin fixed server role can perform any activity in the server.

like image 93
RichardTheKiwi Avatar answered Oct 28 '25 21:10

RichardTheKiwi