Showing posts with label permission. Show all posts
Showing posts with label permission. Show all posts

Wednesday, March 21, 2012

Login Failed for SQL Server db

I recently formatted my pc, everything is set but one thing, the sql server db.

I can't remember how I set the permission for my local machine for the db.

Error: Login Faile for <machineName>\ASPNET

How do I add the user to access the db?

Thanks all,

Zaththe ASPNET is a local account that you need to assign to some role in SQL server.
Create a new Logon in SQL server for that account and give that Login the appropriate DB permissions.

Do NOT make that account a member of your local Administrators group. youd never run a live server that way so dont do it with a dev server either.|||In Enterprise Manager, I added ASPNET for one of the roles.

Still login failed.

I added the new role to the db_owner, still failed.

I went to security folder, added ASPNET there as well in Logins, still no luck.

The conn string I am using is...

<add key="ConnectString" value="Data Source=localhost; Initial Catalog=dbName; User ID=ASPNET; Password=*********; Trusted_Connection=True;"
No wonder I like to stick to coding... LOL

Suggestions?

Thanks,

Zath|||When trusted_connection=true, the userid and password are not required as the user credentials are derived from the machine logon.

i.e the machines ASPNET account.

your connection string includes a userid and password which might be getting evaluated as SQL credentials even though your specifying to use a trusted_connection. (your mixing your security options)

adding the ASPNET machine account to a role is not the same as creating a SQL login with the name ASPNET.

try removinguser id andpassword from your connection string
or
try creating an actual SQL Login and turning off Trusted_Connection|||Try this url http://whoozoo.co.uk/winxpFilePerms.htm use it to configure file permissions
in Windows XP and then give Asp.net account read and write permissions for the application folder before setting up the SQL Server Permissions for same account with DBO permissions in the Database created for the application. Hope this helps.

Kind regards,
Gift Peddie|||I tried both ways and still no luck.

With just the id and password, I get this error...
Login failed for user 'ASPNET'. Reason: Not associated with a trusted SQL Server connection

And with the Trusted_Connection and no id or pw, just the login failed.

Ironically, I work in IIS Admin and am familiar with permissions, but this db thing has me stumped... LOL

I even tried to create a new test db but with the same results.

Any more suggestions will be helpful,

Thanks again,

Zath|||SUCCESS!!!!!

I knew I would get it, I always do... It's a curse I tell ya, a curse... LOL

In SQL Server Enterprise Manager, under the db in question, go to Security Folder, then logins (which I did before)

Create the the new user, in this case I created ASPNET.

But, don't use SQL Server Authentication, but use Windows Authentication.

Input the new user, then choose from the drop down list your local machine name.

I did however create the ASPNET user in the wwwroot folder permissions, don't know if this was required first, most likely... but I'm in.....

And don't know why the userid and pw didn't work, but doesn't matter now....

Used this conn string...

----
<add key="ConnectString" value="Data Source=localhost; Initial Catalog=dbName; Integrated Security=SSPI; PWD=Trusted_Connection=True;"
---
I'm sure when I'm ready to transfer to "production" server and change the conn string, it will work fine because it does in my main app!

Thanks for the help everyone!

Zathsql

Monday, March 12, 2012

Login exists in server and db, but doesn't exist??

I have restored a db onto a server, which has the same Login account that
exists in the db.
When trying to add DBO permission to the Login in the DB Users node I get
this error.
Error 15410: User or role '%s' does not exist in this database.
When trying to add DBO permission to the DB by selecting the Login through
security I get this error.
Error 21002: The Distribution Agent for this subscription already exists
(%s).
When I try to remove user from Database through the User's node I get this
error:
Error 15008: User '%s' does not exist in the current database.
So now I can't add the dbo permission to the user as we need and I can't
remove the invalid User from the db and then add it back in. I have tried
installing the Sync SQL Logins.exe utility, but I can't run it on my
computer. It is looking for mscoree.dll, which does not exist on my
computer. I have run the windows update to make sure my computer has the
latest stuff on it, but it didn't help. I know there must be some script
that will allow me to fix this problem, but after spending 4 hours searching
Microsoft KB and trying several different things I haven't been able to fix
it yet. Is there anyone who can help me with this?
Thanks,
SherryThanks. That was just too simple. I was looking for a complicated fix.
Just goes to show, sometimes you can overthink things. Works now. Thanks
again!
Sherry
"HS" <anonymous@.discussions.microsoft.com> wrote in message
news:084a01c3ce4f$1f3ee660$a001280a@.phx.gbl...[QUOTE]
> Try sp_dropuser or sp_droprole in that particular database
> and readd it after dropping the user.
> Login account that
> Users node I get
> database.
> the Login through
> already exists
> User's node I get this
> database.
> need and I can't
> in. I have tried
> run it on my
> exist on my
> computer has the
> must be some script
> spending 4 hours searching
> haven't been able to fix|||Gr8!!
I have issues with SQL Profiler.. its already in the News
Group titled "Failed to stat a new trace." If anybody can
help.
quote:

>--Original Message--
>Thanks. That was just too simple. I was looking for a

complicated fix.
quote:

>Just goes to show, sometimes you can overthink things.

Works now. Thanks
quote:

>again!
>Sherry
>"HS" <anonymous@.discussions.microsoft.com> wrote in

message
quote:

>news:084a01c3ce4f$1f3ee660$a001280a@.phx.gbl...
database[QUOTE]
DB[QUOTE]
selecting[QUOTE]
subscription[QUOTE]
back[QUOTE]
not[QUOTE]
my[QUOTE]
>
>.
>

Login Error: 18456, Severity: 14, State:11

I have determined the difference between getting the above denial and succes
s
is the enabling of the 'Control server' permission on the 'Server' object
(grant = true -> you can connect) for our application. I am trying to
determine 'what' in our application at time of connect is requiring this
'Control server' permission.
I would have thought 'Connect SQL' permission would be all that is required.
The userid trying to login is a domain account, with NO admistrative
privileges, is trying to access the local (as in local to the machine, not
network access involved) SQLEXPRESS server.
The failure happens immediately trying to open the connection using connect
string
ConnectionString "Data Source=COUGAR\\SQLEXPRESS;Initial
Catalog=RC2Official;Integrated Security=True;Persist Security
Info=False;Pooling=False;Packet Size=4096" stringI have determined that installing a new instance of SQLEXPRESS, on the same
computer, and configured exactly the same as the original instance, I do not
have the problem of requiring 'Control server' permission. A simple 'Connect
Sql' permission will suffice (as I expected)
There is obviously something 'different' about my original SQLEXPRESS
database configuration, or internal tables that is causing the problem.
"Keith Dorken" wrote:

> I have determined the difference between getting the above denial and succ
ess
> is the enabling of the 'Control server' permission on the 'Server' object
> (grant = true -> you can connect) for our application. I am trying to
> determine 'what' in our application at time of connect is requiring this
> 'Control server' permission.
> I would have thought 'Connect SQL' permission would be all that is require
d.
> The userid trying to login is a domain account, with NO admistrative
> privileges, is trying to access the local (as in local to the machine, not
> network access involved) SQLEXPRESS server.
> The failure happens immediately trying to open the connection using connec
t
> string
> ConnectionString "Data Source=COUGAR\\SQLEXPRESS;Initial
> Catalog=RC2Official;Integrated Security=True;Persist Security
> Info=False;Pooling=False;Packet Size=4096" string
>|||Hi,
I understand that you could not locally connect to your SQL EXPRESS server
unless you grant "Control Server" permission to the domain login account.
If I have misunderstood, please let me know.
I think that your connection string is no problem. What is the result if
you explicitly add the database role db_datareader to the user?
Best regards,
Charles Wang
Microsoft Online Community Support
========================================
=============
Get notification to my posts through email? Please refer to:
http://msdn.microsoft.com/subscript...ault.aspx#notif
ications
If you are using Outlook Express, please make sure you clear the check box
"Tools/Options/Read: Get 300 headers at a time" to see your reply promptly.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscript...t/default.aspx.
========================================
==============
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
========================================
==============
This posting is provided "AS IS" with no warranties, and confers no rights.
========================================
==============|||The effect is the same. The problem is the Login is denied. The db_datareade
r
role would be the permissions on the database. The problem is the server is
denying access.
Here is the log of my test:
(This was from a cmd shell running as thoughts\LimitedUser)
C:\Program Files\Microsoft SQL Server\90\Tools\Bin>sqlcmd -S COUGAR\SQLEXPRE
SS
Msg 18456, Level 14, State 1, Server COUGAR\SQLEXPRESS, Line 1
Login failed for user 'thoughts\LimitedUser'.
C:\Program Files\Microsoft SQL Server\90\Tools\Bin>
The SQL server error log shows the lines:
05/31/2007 08:00:48,Logon,Unknown,Login failed for user
'thoughts\LimitedUser'. [CLIENT: <local machine>]
05/31/2007 08:00:48,Logon,Unknown,Error: 18456<c/> Severity: 14<c/> State: 1
1.
The ONLY permission that permits login is the 'Control Server' permission.
Note that I tried turning on ALL the server permissions EXCEPT 'Control
Server' and the login was still denied.
"Charles Wang[MSFT]" wrote:

> Hi,
> I understand that you could not locally connect to your SQL EXPRESS server
> unless you grant "Control Server" permission to the domain login account.
> If I have misunderstood, please let me know.
> I think that your connection string is no problem. What is the result if
> you explicitly add the database role db_datareader to the user?
> Best regards,
> Charles Wang
> Microsoft Online Community Support
> ========================================
=============
> Get notification to my posts through email? Please refer to:
> [url]http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif[/ur
l]
> ications
> If you are using Outlook Express, please make sure you clear the check box
> "Tools/Options/Read: Get 300 headers at a time" to see your reply promptly
.
>
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscript...t/default.aspx.
> ========================================
==============
> When responding to posts, please "Reply to Group" via
> your newsreader so that others may learn and benefit
> from this issue.
> ========================================
==============
> This posting is provided "AS IS" with no warranties, and confers no rights
.
> ========================================
==============
>|||Keith Dorken (kadorken@.nospam.nospam) writes:
> I have determined the difference between getting the above denial and
> success is the enabling of the 'Control server' permission on the
> 'Server' object (grant = true -> you can connect) for our application. I
> am trying to determine 'what' in our application at time of connect is
> requiring this 'Control server' permission. I would have thought
> 'Connect SQL' permission would be all that is required.
> The userid trying to login is a domain account, with NO admistrative
> privileges, is trying to access the local (as in local to the machine, not
> network access involved) SQLEXPRESS server.
> The failure happens immediately trying to open the connection using
> connect string
> ConnectionString "Data Source=COUGAR\\SQLEXPRESS;Initial
> Catalog=RC2Official;Integrated Security=True;Persist Security
> Info=False;Pooling=False;Packet Size=4096" string
What happens if you try to login with SQLCMD to the Express instance
with the same login?
Does "SELECT * FROM sys.server_permissions WHERE state = 'D'" return
anything? "SELECT * FROM sys.database_permissions WHERE state = 'D'"?
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Hi,
From this article, we can see that CONTROL SERVER permission is implicitly
impact many other server permissions including CONNECT SQL. By default, if
you create a login (CONNECT SQL is granted), it is granted automatically. I
think that this permission might be denied sometime before. That is why
you must grant CONTROL SERVER permission
GRANT Server Permissions (Transact-SQL)
http://msdn2.microsoft.com/en-us/library/ms186717.aspx
You can run the T-SQL statement to check the server permissions:
SELECT t2.name,t1.* FROM sys.server_permissions t1 , sys.server_principals
t2 where t1.grantee_principal_id = t2.principal_id and t1.type<>'R'
By default, once a new login created, there is only one permission CONNECT
SQL record in the result of this query.
If you have any other questions or concerns, please feel free to let me
know. It is my pleasure to be of assistance.
Best regards,
Charles Wang
Microsoft Online Partner Support
PLEASE NOTE: The partner managed newsgroups are provided
to assist with break/fix issues and simple how to questions.
We also love to hear your product feedback!
Let us know what you think by posting
- from the web interface: Partner Feedback
- from your newsreader:
microsoft.private.directaccess.partnerfeedback.
We look forward to hearing from you!
========================================
==============
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
========================================
==============
This posting is provided "AS IS" with no warranties, and confers no rights.
========================================
==============|||"Erland Sommarskog" wrote:

> What happens if you try to login with SQLCMD to the Express instance
> with the same login?
That is how subsequent testing was done (using SQLCMD running from a cmd
shell that was operating under the username 'THOUGHTS\LimitedUser'). The
failure is the same.
> Does "SELECT * FROM sys.server_permissions WHERE state = 'D'" return
> anything? "SELECT * FROM sys.database_permissions WHERE state = 'D'"?
>
There are no entries found using the above selects. All entries have
'CONNECT SQL' with a 'G' state.
> --
> Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/pr...oads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodin...ions/books.mspx
>|||Surely you do not have to grant CONTROL SERVER permission for a Login to
access the database. CONTROL SERVER permission IMPLIES ALL the permissions t
o
the server (pretty powerful user!) The user should only require the default
CONNECT SQL permission.
Please note that I tried the case where I GRANTED ALL the permissions
IMPLIED by CONTROL SERVER, but NOT CONTROL SERVER itself and the Login was
still denied.
There is still something that CONTROL SERVER permission 'gives you' besides
implying all the other server permissions (but I don't know what 'that' is)
"Charles Wang[MSFT]" wrote:

> Hi,
> From this article, we can see that CONTROL SERVER permission is implicitly
> impact many other server permissions including CONNECT SQL. By default, if
> you create a login (CONNECT SQL is granted), it is granted automatically.
I
> think that this permission might be denied sometime before. That is why
> you must grant CONTROL SERVER permission
> GRANT Server Permissions (Transact-SQL)
> http://msdn2.microsoft.com/en-us/library/ms186717.aspx
Granting CONTROL SERVER allows the login. CONNECT SQL permission alone
should suffice (it does on the OTHER SQLEXPRESS instance running on the same
computer).
The question is why does one instance of SQLEXPRESS with (as far as I can
determine) the same configuration deny login and the other instance does not
.
Where in the registry (if any) should I look to start comparing
configuration parameters for the SQL server instances to determine if there
is some left over registry value that may be causing the problem ?
Anyplace else ? Other sys.* databases ?

> You can run the T-SQL statement to check the server permissions:
> SELECT t2.name,t1.* FROM sys.server_permissions t1 , sys.server_principal
s
> t2 where t1.grantee_principal_id = t2.principal_id and t1.type<>'R'
Here is the result of your SELECT statement:
sa 100 SERVER 0 0 1 1 COSQ CONNECT SQL G GRANT
public 100 SERVER 0 0 2 1 VWDB VIEW ANY DATABASE G GRANT
##MS_SQLResourceSigningCertificate## 100
SERVER 0 0 101 1 VWAD VIEW ANY
DEFINITION G GRANT
##MS_SQLReplicationSigningCertificate##
100 SERVER 0 0 102 1 AUTH AUTHENTICA
TE SERVER G GRANT
##MS_SQLReplicationSigningCertificate##
100 SERVER 0 0 102 1 VWAD VIEW ANY
DEFINITION G GRANT
##MS_SQLReplicationSigningCertificate##
100 SERVER 0 0 102 1 VWSS VIEW
SERVER STATE G GRANT
##MS_SQLAuthenticatorCertificate## 100 S
ERVER 0 0 103 1 AUTH AUTHENTICATE
SERVER G GRANT
BUILTIN\Administrators 100 SERVER 0 0 25
7 1 COSQ CONNECT SQL G GRANT
NT AUTHORITY\SYSTEM 100 SERVER 0 0 258 1 CO
SQ CONNECT SQL G GRANT
COUGAR\SQLServer2005MSSQLUser$COUGAR$SQL
EXPRESS 100 SERVER 0 0 259 1 COSQ CO
NNECT SQL G GRANT
BUILTIN\Users 100 SERVER 0 0 260 1 COSQ
CONNECT SQL G GRANT
COUGAR\SQLServer2005MSFTEUser$COUGAR$SQL
EXPRESS 100 SERVER 0 0 265 1 COSQ CO
NNECT SQL G GRANT
##MS_AgentSigningCertificate## 100 SERVE
R 0 0 269 1 COSQ CONNECT SQL G GRANT
COUGAR\logouser1 100 SERVER 0 0 271 1 CO
SQ CONNECT SQL G GRANT
THOUGHTS\limiteduser 100 SERVER 0 0 276
1 COSQ CONNECT SQL G GRANT
> By default, once a new login created, there is only one permission CONNECT
> SQL record in the result of this query.
And that is the only permission I want for this user. But they cannot connec
t.|||Keith Dorken (kadorken@.nospam.nospam) writes:
> "Erland Sommarskog" wrote:
> That is how subsequent testing was done (using SQLCMD running from a cmd
> shell that was operating under the username 'THOUGHTS\LimitedUser'). The
> failure is the same.
And you tried to connect to the same database, or did you also try one
like tempdb?
What happens if you create an SQL login and try with that one.
Have you checked that there are no logon triggers on the server?
Sorry, I don't really have any good ideas, and I am just clutching at
straws.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Lines: 49
X-Tomcat-ID: 91232475
MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
Organization: Microsoft
X-Tomcat-NG: microsoft.public.sqlserver.security
NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
Xref: leafnode.mcse.ms microsoft.public.sqlserver.security:3486
Hi Kadorken,
Thanks for your response.
I am consulting the product team on this issue. I will let you know the
result as soon as possible.
Since the process may need a long time, I also recommend that you give
Microsoft feedback via the following link:
http://connect.microsoft.com/sql
(please logon first before you submit a feedback.)
Best regards,
Charles Wang
Microsoft Online Community Support
========================================
=============
Get notification to my posts through email? Please refer to:
http://msdn.microsoft.com/subscript...ault.aspx#notif
ications
If you are using Outlook Express, please make sure you clear the check box
"Tools/Options/Read: Get 300 headers at a time" to see your reply promptly.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscript...t/default.aspx.
========================================
==============
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
========================================
==============
This posting is provided "AS IS" with no warranties, and confers no rights.
========================================
==============