runas - 1326: Logon failure: unknown user name or bad password

2

1

I tried to execute notepad from cmd using the following command-

runas /noprofile /user:<username>@<ip> notepad

Then I got this output where I was asked to enter my password

Enter the password for <username>@<ip>:

After entering my password (which is correct), I got this output-

Attempting to start notepad as user "<username>@<ip>" ...
RUNAS ERROR: Unable to run - notepad
1326: Logon failure: unknown user name or bad password.

Any idea why I got the above output? I'm actually a dummy when it comes to programming and scripting in windows terminals. Also, is it possible for me to avoid the interaction part where I'm asked for password and enter it as part of the runas command itself?

AlwaysALearner

Posted 2013-08-20T13:18:22.537

Reputation: 333

Answers

2

The "user" parameter expects user credentials that consist of a user name and an (optional) domain name, you can't use an IP address as you are attempting.

From runas /?:

<UserName> should be in form USER@DOMAIN or DOMAIN\USER

If you have no domain, you can use the target computer's name so that it knows to look there for the credential store to check against.

As to including the password so you don't have to type it, no you can't do that, as it is considered insecure.

Perhaps check out these SU questions related to dealing with that:

Ƭᴇcʜιᴇ007

Posted 2013-08-20T13:18:22.537

Reputation: 103 763

0

As I am not allowed to comment yet... Is this an Active Directory environment , or do you try to access a User or Group from an other computer.

If it's an AD environment i suggest NOT to use an IP but the domain name (NetBios name is also OK)

I just tried this out on my own an it worked out. (result is german)

 C:\Users\user>runas /noprofile /user:testuser@foobar.com notepad
Geben Sie das Kennwort für "testuser@foobar.com" ein:
Es wird versucht, notepad als Benutzer "testuser@foobar.com" zu starten...

C:\Users\user>runas /noprofile /user:foo_bar\testuser notepad
Geben Sie das Kennwort für "foo_bar\testuser" ein:
Es wird versucht, notepad als Benutzer "foo_bar\testuser" zu starten...

C:\Users\user>runas /noprofile /user:foobar.com\testuser notepad
Geben Sie das Kennwort für "foobar.com\testuser" ein:
Es wird versucht, notepad als Benutzer "foobar.com\testuser" zu starten...

Daywalker

Posted 2013-08-20T13:18:22.537

Reputation: 126

0

If you want to specify username and password on command-line you can try PsExec from Syinternals/Microsoft.

Robert

Posted 2013-08-20T13:18:22.537

Reputation: 4 857