connecting to remote sql express server

146 Views Asked by At

I have a program running with an EF model in c#. when running the app from my local computer everything runs great but when installing it on a different computer in my network it immediately stop responding. i noticed that after adding the specific user to the logins in SSMS everything works if i give him a sysadmin permission (public is not enough). is it a security risk to give this permission? is there a way that upon first run of the program or during the setup the user will be automatically added to the logins of the sql server? Many thanks

1

There are 1 best solutions below

2
On

Instead of adding every single user in Sql Server just create an Login that is mapped to a domain group (YOURDOMAIN\Users or a custom group if you want to limit access to a specific group of users) and has your database as the default database (instead of master).

Usually it should not be necessary to grant to sysadmin role if you create the aforementioned Login and grant public access to your database (User Mapping).