[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Logon failure: unknown user name or bad password.

Posted on 2005-05-12
17
Medium Priority
?
3,281 Views
Last Modified: 2007-12-19
sql2k sp3

I am boggled here. This isn't the typical scenario that normally generates
this message from what I can tell. I have all the necessary permissions from
what I know.

2 boxes.

1. All SQL Services run in the same Domain Administrator accout for both
boxes.
2. I have a linked server for Box2 on Box1. I can call
Box2.DBName.dbo.ProcName from Box1 with no problems.
3. I am logged in as the same Domain Admin account that all the services are
running under.
4. But I can't seem to use xp_cmdshell to copy a file from Box1 to Box2. I
get the above error message. 5. I can however take the "copy code" from
Query Analyzer and successfully run it from the DOS window.

All ideas are appreciated.

TIA, ChrisR
0
Comment
Question by:rseraji
  • 8
  • 7
15 Comments
 
LVL 28

Accepted Solution

by:
rafrancisco earned 300 total points
ID: 13988034
In Enterprise Manager, go to Management, right-click on SQL Server Agent and go to Job System tab.  Click on the Reset Proxy Account and enter the Domain Account you are using.  Once done, try your xp_cmdshell command again.
0
 
LVL 3

Author Comment

by:rseraji
ID: 13988062
Ive already tried that. Really that should have nothing to do with it as thats for non SA users. But I thought Id give it a shot.
0
 
LVL 28

Expert Comment

by:rafrancisco
ID: 13988156
Does doing a simple command work:

exec xp_cmdshell 'dir'
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:rseraji
ID: 13989804
No.
0
 
LVL 28

Expert Comment

by:rafrancisco
ID: 13989951
Do you get anything when you execute this:

EXEC master.dbo.xp_sqlagent_proxy_account N'GET'
0
 
LVL 3

Author Comment

by:rseraji
ID: 13990120
Nothing returned.
0
 
LVL 28

Expert Comment

by:rafrancisco
ID: 13990147
Try this:

EXEC master.dbo.xp_sqlagent_proxy_account N'SET', N'<Your Domain>', N'<Your User Name>', N'<Your Password>'

Then try this and see if you get any result:

EXEC master.dbo.xp_cmdshell 'dir'
0
 
LVL 3

Author Comment

by:rseraji
ID: 13991453
Nope.

declare @Source varchar(128)
set @Source = '"dir \\Box2\c$"'
exec xp_cmdshell @Source

Logon failure: unknown user name or bad password.


But I can run this command from DOS.

0
 
LVL 28

Expert Comment

by:rafrancisco
ID: 13991497
How about a simple "dir":

declare @Source varchar(128)
set @Source = 'dir'
exec xp_cmdshell @Source

try without the double-quotes in the 'dir'
0
 
LVL 3

Author Comment

by:rseraji
ID: 13991742
Assuming you meant:

declare @Source varchar(128)
set @Source = 'dir \\Box2\c$\'
exec xp_cmdshell @Source

no, this doesnt work.
0
 
LVL 28

Expert Comment

by:rafrancisco
ID: 13991772
How about a simple dir without the \\Box2\c$:

declare @Source varchar(128)
set @Source = 'dir'
exec xp_cmdshell @Source

I am trying to determine if the error is caused by the xp_cmdshell command or by connecting to the \\Box2 server.

If this command returns a result set, then check if there is a local account/user name in Box2 having the same user name that you are using.  If there is, the local account/user name might have a different password than the domain account.
0
 
LVL 3

Author Comment

by:rseraji
ID: 13991813
Yes that works. The Local Admin on theat box has a different password than the Domain Admin Im using. Dont forget:

4. But I can't seem to use xp_cmdshell to copy a file from Box1 to Box2. I
get the above error message. 5. I can however take the "copy code" from
Query Analyzer and successfully run it from the DOS window.
0
 
LVL 3

Author Comment

by:rseraji
ID: 13997187
Also, I changed the local admin on that box to the same as the Domain Admin, and still have the problem.
0
 
LVL 28

Expert Comment

by:rafrancisco
ID: 13997760
Here's a long shot and I don't know if it can be an option for you.  Why not map \\Box2\c$ as a local drive and simply use this instead of the network drive?
0
 
LVL 3

Author Comment

by:rseraji
ID: 13998416
This fixed it and I dont know why.

-- ACCOUNTDOMAIN is the domain where 'account' belongs to
EXEC xp_cmdshell 'dir \\BoxName\Share password
/USER:MYDOMAIN\administrator'
GO


I only had to do it the first time and now my original command works with no problems.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
Backups and Disaster RecoveryIn this post, we’ll look at strategies for backups and disaster recovery.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

830 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