Problem with logging in to hast by invoking a command from the command line

Implemented

Problem with logging in to hast by invoking a command from the command line

avatar

Hi!

I have a problem with logging in to the host by calling a command from the command line.

I use this command (example values):

open -a "/Applications/Remote Desktop Manager Free.app" "rdm://open?DataSource=ce421242-bdc0-4ecf-b93b-288fbc23c1b1&Template=fe25e253-7440-421f-9e44-811e74a41c70&Host=testing.my.domain.com&Username=j.smith&Domain=TESTING&Password=1234567890"

I get an error ERRCONNECT_LOGGON_FAILURE 0x00000014

when I change the command to (without Password):
open -a "/Applications/Remote Desktop Manager Free.app" "rdm://open?DataSource=ce421242-bdc0-4ecf-b93b-288fbc23c1b1&Template=fe25e253-7440-421f-9e44-811e74a41c70&Host=testing.my.domain.com&Username=j.smith&Domain=TESTING"

a window appears where I can enter the password. After entering the password and confirming it, I can log in to the host.

when I change the commands to (without Username):
open -a "/Applications/Remote Desktop Manager Free.app" "rdm://open?DataSource=ce421242-bdc0-4ecf-b93b-288fbc23c1b1&Template=fe25e253-7440-421f-9e44-811e74a41c70&Host=testing.my.domain.com&Domain=TESTING&Password=1234567890"

a window appears with the Domain field completed, the Username field empty (ok, I did not provide the Username), but also with an empty Password field (I provided it in the command line).

My suspicion is that the value of the Password parameter is not being passed from the command line.
Or I'm doing something wrong
Please help.

Software version: 2020.2.3.0
MacOS: Catalina 10.15.6

Best regards
Krzysztof

All Comments (9)

avatar

Hi,

I can assure you that the password is properly passed to the connection on launch. That being said, I've confirmed that the Domain does not seem to be passed, which I believe is probably the problem in your case. I've opened a ticket to properly handle the Domain.

Best regards,

Xavier Fortin

avatar

Thank for quick replay.

Hmm, I still think I have no problem with Domain but With Password. As you can see on screenshot below Domain is passed.

Command I run:
open -a "/Applications/Remote Desktop Manager Free.app" "rdm://open?DataSource=ce421242-bdc0-4ecf-b93b-288fbc23c1b1&Template=fe25e253-7440-421f-9e44-811e74a41c70&Host=testing.my.domain.com&Username=j.smith&Domain=TESTING"

When I run command
open -a "/Applications/Remote Desktop Manager Free.app" "rdm://open?DataSource=ce421242-bdc0-4ecf-b93b-288fbc23c1b1&Template=fe25e253-7440-421f-9e44-811e74a41c70&Host=staging.aws.metapack.com&Username=j.smith&Domain=TESTING&Password=1234567890"

this window doesn't appear and I get en error what I mentioned before. The same problem is when I try to connect using local user 'Administrator' without Domain.
forum image
Best regards,
Krzysztof

avatar

I just realized the "&Template=" in your URL. I was checking assuming "&Session=". With Template, the Domain is properly passed, so is the Password though.

I've tested on my side and with a newly created Template (admittedly with no settings whatsoever), my session launch properly. In your case, we know that the password (or something at the very least) is "passed" to the session, because, as you've noted in your first post, if it was not past at all, a prompt would be shown to fill the password. This means that something is passed as the password.

It is possible that your password contains characters that need escaping. For instance \ and " are characters that need to be escaped in a string literal. For instance, if the password was something like this: qw\de34"f09, it would need to be past like this: "qw\\de34\"f09". That being said, with the previous example, the command would not execute (without the escaping) because the single " would break the sequence. In your case, it could be something more insidious, like double \\ that just translate to a single \ or a special escaped character like \t that translates to a tab space character.

I'd start there. You could echo the password sequence to see if it resolve properly (e.g. echo "qw\\de34\"f09" resolves to qw\de34"f09).

Outside this, have you made sure to connect to the right port?

If you set the same credentials directly in the Template (as a test) and run the same command but without passing any Username, Domain and Passwords, does it work then?

Best regards,

Xavier Fortin

avatar

I think you are right, the password is being passed because the prompt window does not appear. But there is something wrong with the password value.

You mentioned that I should use `echo`, but where to use it? I type the password directly on the command line so I can see it.

My password contains the characters $, #, &. I escaped them all at once and one by one, but it doesn't help.

Outside this, have you made sure to connect to the right port?
Yes, port is correct

If you set the same credentials directly in the Template (as a test) and run the same command but without passing any Username, Domain and Passwords, does it work then?
Yes, in that case it works

Best regards

avatar

Another thing.
When pass Password and Domain but not pass Username prompt window appears with filled Domain field and empty Username field (ok) but also with EMPTY Password field.

Best regards
Krzysztof

avatar

I did many tests and my conclusion is:

  1. there is a problem passing a domain parameter (as you mention)
  2. special characters in the password need to be escaped, but i don't know how. I did many attempts to escaping chars but with no success


Below there is a script

# host='testing.my.domain.com' # doesn't work
# user='j.smith'
# domain='TESTING'
# password='vgsU$wo5Aru#ropli2&p'

# host='testing.my.domain.com' # it works
# user='Administrator'
# domain=''
# password='pLI7894ZXDh2x4tAjsnhJb6XSkoK@D-GR'

# host='testing.my.domain.com' # doesn't work
# user='j.smith'
# domain='PRODUCTION'
# password='poZ1#T8bWxlQoPkB7sd'

# host='testing.my.domain.com' # doesn't work
# user='j.smith'
# domain='CLOUD'
# password='kjT?PP($Sq4!GNJD'

# host='testing.my.domain.com' # doesn't work
# user='Administrator'
# domain=''
# password='szx8sAb65E1Q3cZu%!w*cpM)&Np3TR1@'

open -a "/Applications/Remote Desktop Manager Free.app" "rdm://open?DataSource=ce421242-bdc0-4ecf-b93b-288fbc23c1b1&Template=fe25e253-7440-421f-9e44-811e74a41c70&Host=${host}&Domain=${domain}&Username=${user}&Password=${password}"

Passwords are fake but they contain special char like real passwords.

Best regards,
Krzysztof

avatar

Hi,

Another thing I forgot to mention, rdm:// is an URL. So any parameters passed to it must be URL encoded. For instance, "vgsU$wo5Aru#ropli2&p" would become "vgsU%24wo5Aru%23ropli2%26p". In a script, you could use a function to URL encodes your parameters, such as this:

urlencode() {
# urlencode <string>

old_lc_collate=$LC_COLLATE
LC_COLLATE=C

local length="${#1}"
for (( i = 0; i < length; i++ )); do
local c="${1:$i:1}"
case $c in
[a-zA-Z0-9.~_-]) printf '%s' "$c" ;;
*) printf '%%%02X' "'$c" ;;
esac
done

LC_COLLATE=$old_lc_collate
}

host=$(urlencode "testing.my.domain.com")
user=$(urlencode 'j.smith')
domain=$(urlencode 'TESTING')
password=$(urlencode 'vgsU$wo5Aru#ropli2&p')

open -a "/Applications/Remote Desktop Manager Free.app" "rdm://open?DataSource=ce421242-bdc0-4ecf-b93b-288fbc23c1b1&Template=fe25e253-7440-421f-9e44-811e74a41c70&Host=${host}&Domain=${domain}&Username=${user}&Password=${password}"

All credits for above code goes here.

Best regards,

Xavier Fortin

avatar

It looks like working now.

Thank you for your help!

Best regards,
Krzysztof

avatar

Hi,

Glad to hear it!

Do not hesitate if you have any other issues.

Best regards,

Xavier Fortin