Link to home
Start Free TrialLog in
Avatar of rseraji
rseraji

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of rafrancisco
rafrancisco

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rseraji
rseraji

ASKER

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.
Does doing a simple command work:

exec xp_cmdshell 'dir'
Avatar of rseraji

ASKER

No.
Do you get anything when you execute this:

EXEC master.dbo.xp_sqlagent_proxy_account N'GET'
Avatar of rseraji

ASKER

Nothing returned.
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'
Avatar of rseraji

ASKER

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.

How about a simple "dir":

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

try without the double-quotes in the 'dir'
Avatar of rseraji

ASKER

Assuming you meant:

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

no, this doesnt work.
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.
Avatar of rseraji

ASKER

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.
Avatar of rseraji

ASKER

Also, I changed the local admin on that box to the same as the Domain Admin, and still have the problem.
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?
Avatar of rseraji

ASKER

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.