Grant users permission to stored procedures - sql-server

I'm not very knowledgeable of ASP.NET or MS SQL at all, but was asked to migrate a website based on ASP.NET to a new host. I am moving the site to a HostGator Windows Shared account.
There is a small admin section of the site that has a MS SQL database behind it. I obtained a copy of this database in a .bak file from the previous host.
I was a able to create a MS SQL database in HostGator and import the backup file into it. The database came with a user that was being used to connect to the database from the website.
Although before being able to connect to the DB with this user, HostGator forced me change it's username to conform to their format of "HostGatorUserName_UserName".
Then after successfully connecting to the DB with this user, I got the "Cannot find stored procedure" error. I found out this is probably due to the user not having permission to access any of the stored procedures it did before. I believe this is probably due to the username having been changed.
Now I have no idea how to restore permissions to these stored procedures to the user. HostGator does not provide any web admin for MS SQL although I was able to connect to the database (with the same user) with Oracle SQL Developer (I'm on a Mac). I've googled how to grant permissions to a stored procedure to a user, but of course I cannot grant permissions to myself. I can't find anywhere in Plesk on HostGator where I can manage permissions for existing users or ones I create.

If this is the only login HostGator has provided you, then they need to elevate the rights (probably by adding the user to the dbo role). This may not be what you want, but it's not clear to me what was in place before this database got restored. Did you have a login to the server that could access other databases?
If they also gave you a different login to connect with, that login is probably in the dbo role. So you can login as that user and then:
GRANT EXEC ON dbo.procedure_name TO HostGatorUserName_UserName;
(Sorry but I don't know anything about Plesk. And you'll probably get better answers if you talk to HostGator support to get your access rights straightened out.)

Related

Password protected database SQL Server with SSMS

we launched new SQL Server on AWS. Everything looks great, I can access the server via SSMS. However, I can't set up new credentials for one specific database.
This database should be accessible via MS Access. It works in MS Access, when admin login and password, but I would like to give the users access only to the specific database.
I read this article and I guess I should created SQL user with password:
https://learn.microsoft.com/en-us/sql/relational-databases/security/authentication-access/create-a-database-user?view=sql-server-2017
Unfortunately, I do not see this option in SSMS.
Don't you have any idea please, why it is so?
So my comprehensive requirement:
1. I need to set up password protected database.
2. This database will serve linked tables for MS Access.
Thank you very much for help,
Vaclav
I have already found a solution. My login didn't have an appropriate server rights. To create a new user and define his permissions you have to "Server role" - securityadmin assigned to your login.
It is described here:
https://learn.microsoft.com/en-us/sql/relational-databases/security/authentication-access/server-level-roles?view=sql-server-2017
Best regards,
Vaclav

Could not obtain information about windows nt group/user sql server error

I migrated my Access Backend to SQL Server using SQL Server Migration Assistant. During the Installation of SQL Server I made sure that my windows account was set up as the sys admin. When I view my login "office/dave" I can see that I have sys admin server role. I have access to every objects in the SQL Backend when I am browsing through SSMS but I could not access the database diagrams.
I did fix this issue by changing the database owner to [sa] from "office/dave" in the database properties and this let me access the database diagram but I do not understand why this fixed the problem.
I was connected as sys admin and database owner. Why is this fix needed?
This might help someone in the future. This error can occur which did for me because I was logged in as Domain User and was not connected to local User. This error can be fixed by changing the database owner to [sa] account.

How do I copy permissions from one database to another?

I have two databases on the same SQL server. One for an ERP database that I am able to read tables and one I created in MS Access. A store procedure on the MSAccess database is updating some tables from the ERP DB. The MS Access DB from here on is independently running.
When I installed on other computers, the Access Database is giving me a connection error when I am logged in as another user than myself.
- Are permissions from the ERP database affecting me in my Access Database? Should I worry about them?
- Is Windows Authentication enough to make the connection happen?
- Do I need to Map the users over from the ERP database?? if so, how do I do it?
- Can I grant every user on the Server permission to access my tables using Windows Authentication? do I need to go down this road? How do I do it?
I am just not too sure what to do from here on. Here is some more information about the issue.
-In my database I have a ODBC stringconnection that looks like this:
Driver={SQL Server Native Client 11.0};Server=SERVER;Database=DATABASENAME;Trusted_Connection=yes;
-I am packaging an exe file using SSESETUP which is awesome.
-I am installing on the new computer and able to launch when I am logged on as myself however, I am getting a connection error when I am logged in as another user on the same computer. (Note: I am not able to debug from here on and see the vba because I am running under Access runtime 2013 only.)
I would appreciate if someone can assist me in narrowing my search for a solution.
Bottom line, it sounds like you need to set up database permissions on your SQL Server for each Windows account that will be using your Access db.
Here are specific answers to your questions:
Are permissions from the ERP database affecting me in my Access
Database
Yes, of course they are. Regardless of how you connect to the database the permissions will always be in effect.
Should I worry about them?
Yes, of course you should. Otherwise you won't be able to work with the data.
Is Windows Authentication enough to make the connection happen?
To make the connection, yes. SQL Server supports Windows authentication in both security modes (Windows only and mixed mode). But, this is just the connection. You also need to take the database permissions into consideration. Your Windows login needs to be granted the appropriate permissions within the specific database in order to do anything.
Do I need to Map the users over from the ERP database?
Map to what? Access? Based on the connection string in your question you're using Windows authentication to connect Access to SQL Server, so Access will connect to SQL Server under the security context of whoever is running Access. So the SQL Server permissions will need to be configured for each user who will be running your Access db.
Can I grant every user on the Server permission to access my tables
using Windows Authentication?
Access to the SQL Server tables? Sure, you could. But you should limit it to only the necessary permissions. Granting access for everyone is likely overkill and not best practice.

All actions denied on MS SQL Server on Go Daddy Hosting

i have a website hosted on GoDaddy and I need to create a database for it. So headed to the Databases section and created a MS SQL Database then on my local pc I tried to access the database via SQL Server Management studio, I was able to login to the database but I cannot make any operations. I get it does not exist or you do not have permission. So deciced to go the Security tab, then Login and tried to change my username that I'm using to systemadmin role but I also got Cannot alter the server role 'sysadmin', because it does not exist or you do not have permission. What could be the problem? There are no other accounts on it. The default sa account is disbaled and I can't enable it coz it will prompt no permissions etc.
I don't understand it. Why GoDaddy allows me to create a database but with no permissions or rather I cannot alter it. Anyone facing the same issue? Thanks
Well it's quite clear. You cannot set yourself as an SA. This would be a great security breach!
You need to add a Login in your database for your account. I think you headed to the server logins. The server login seem to be ok, as you already said. You can connect to the server itself. You need to add a login or a loginmapping to your server login inside your database.
I don't know the backend of goDaddy, but I'm pretty sure that you have some credentials provided after creating your database.

SQL Server: Granting db_datawriter on all databases

I want to manage permissions and access to a SQL Server database server on a development machine. I've created a local windows group (called DBReaderGroup) and assigned various people to it. The group was created as a SQL Server login successfully:
create login [MYMACHINE\DBReaderGroup] from windows
My goal is to grant this group read/write access to all databases (which are constantly being added and dropped). Is it possible to configure the right settings so that SQL Server manages this?
My biggest challenge is that each time a db is created, I have to update the "User Mapping" settings for this group on the new database.
Am I missing something simple?
Add the login to the Model database in the db_datawriter role, and any new database will give that login full write access by default. This won't work, however, if the databases being added are from other sources (ie restored versions).

Resources