Logon failure: unknown user name or bad password.

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
LVL 3
rserajiAsked:
Who is Participating?
 
rafranciscoCommented:
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
 
rserajiAuthor Commented:
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
 
rafranciscoCommented:
Does doing a simple command work:

exec xp_cmdshell 'dir'
0
Network Scalability - Handle Complex Environments

Monitor your entire network from a single platform. Free 30 Day Trial Now!

 
rserajiAuthor Commented:
No.
0
 
rafranciscoCommented:
Do you get anything when you execute this:

EXEC master.dbo.xp_sqlagent_proxy_account N'GET'
0
 
rserajiAuthor Commented:
Nothing returned.
0
 
rafranciscoCommented:
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
 
rserajiAuthor Commented:
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
 
rafranciscoCommented:
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
 
rserajiAuthor Commented:
Assuming you meant:

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

no, this doesnt work.
0
 
rafranciscoCommented:
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
 
rserajiAuthor Commented:
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
 
rserajiAuthor Commented:
Also, I changed the local admin on that box to the same as the Domain Admin, and still have the problem.
0
 
rafranciscoCommented:
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
 
rserajiAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.