special characters in password

Advertisement

fima62
Joined:
Posts:
6

special characters in password

:cry:
Hello,
I've got identification's problem via script.
Here what happens:
1. I've created my public and private keys
2. The public key is installed on the remote server
3. If I do a connection via GUI I'm able to start my connection (using my user and password)
4. I've created a simple script to start my connection
winscp.exe /console /script=example.txt /log=prova.log
this is my example.txt:
option batch on
open myuser:mypassword@server.com
close
5. My problem is the password that I use
(example:!Pippo01;)
6. in the docs section I found that I have to use the hexadecimal ASCII code but I don't understand how,
I'm trying in this way: open myuser:%21Pippo09%3b@server.com but it doesn't work.

Can you help me ?

Thanks
Marco

Reply with quote E-mail

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: special characters in password

First you mention:
example:!Pippo01;
then
%21Pippo09%3b

They are obviously not the same.
Anyway I do not think you need to encode ! and ;.

Reply with quote

fima62
Joined:
Posts:
6

Re: special characters in password

martin wrote:

First you mention:
example:!Pippo01;
then
%21Pippo09%3b

They are obviously not the same.
Anyway I do not think you need to encode ! and ;.

You're right it's not a problem of special characters.
I tried both syntax on the password field (first with !Pippo01; than with %21Pippo09%3b)
but I can't login.
My problem is that my password it's not accepted.
If I do the connection via GUI it works, but if I try via script (using the same user and password that I use via GUI) in the log I've got an "Access denied").
This is what I'm using:
winscp.exe /console /script=prova.txt /log=prova.log
and the script prova.txt is:
option batch on
option confirm off
open myuser:mypassword@myserver.com
close
exit

Please can you help me I've to fix the problem before the end of this month ?

Thanks a lot
Marco

Reply with quote E-mail

martin
Site Admin
martin avatar

Re: special characters in password

Are you sure you are using the same protocol in GUI and script?
You can try saving the options that work in GUI into stored session and use that stored session in script (open "stored_session_name").

Reply with quote

fima62
Joined:
Posts:
6

Re: special characters in password

martin wrote:

Are you sure you are using the same protocol in GUI and script?
You can try saving the options that work in GUI into stored session and use that stored session in script (open "stored_session_name").

Hi Martin,

if I use open "stored_session_name" it works but it ask me for the password.

PS: I forgot to tell you that via GUI it ask me for the password as well.
even if I've tried to tick the save password checkbox.

Thanks again

Reply with quote E-mail

Advertisement

fima62
Joined:
Posts:
6

Re: special characters in password

Hello,

this is my prova.txt script:
option batch on
option confirm off
open xxxxxx:mypasswd@host.name.ch
close
exit
and the log I've got using the following batch file
echo on
winscp.exe /console /script=prova.txt /log=prova.log
. 2008-10-13 16:52:59.746 --------------------------------------------------------------------------
. 2008-10-13 16:52:59.746 WinSCP Version 4.1.7 (Build 413) (OS 5.2.3790 Service Pack 1)
. 2008-10-13 16:52:59.746 Login time: lunedì, 13. ottobre 2008 16:52:59
. 2008-10-13 16:52:59.746 --------------------------------------------------------------------------
. 2008-10-13 16:52:59.746 Session name: mysession
. 2008-10-13 16:52:59.746 Host name: host.name.ch (Port: 22)
. 2008-10-13 16:52:59.746 User name: xxxxxx (Password: Yes, Key file: No)
. 2008-10-13 16:52:59.746 Tunnel: No
. 2008-10-13 16:52:59.746 Transfer Protocol: SFTP (SCP)
. 2008-10-13 16:52:59.746 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2008-10-13 16:52:59.746 Proxy: none
. 2008-10-13 16:52:59.746 SSH protocol version: 2; Compression: No
. 2008-10-13 16:52:59.746 Bypass authentication: No
. 2008-10-13 16:52:59.746 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2008-10-13 16:52:59.746 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2008-10-13 16:52:59.746 SSH Bugs: -,-,-,-,-,-,-,-
. 2008-10-13 16:52:59.746 SFTP Bugs: -,-
. 2008-10-13 16:52:59.746 Return code variable: Autodetect; Lookup user groups: Yes
. 2008-10-13 16:52:59.746 Shell: default, EOL: 0
. 2008-10-13 16:52:59.746 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2008-10-13 16:52:59.746 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2008-10-13 16:52:59.746 Local directory: default, Remote directory: home, Update: No, Cache: Yes
. 2008-10-13 16:52:59.746 Cache directory changes: Yes, Permanent: Yes
. 2008-10-13 16:52:59.746 DST mode: 1
. 2008-10-13 16:52:59.746 --------------------------------------------------------------------------
. 2008-10-13 16:52:59.746 Looking up host "host.name.ch"
. 2008-10-13 16:52:59.777 Connecting to xxx.xxx.xxx.xxxx port 22
. 2008-10-13 16:52:59.793 Selecting events 63 for socket 1692
. 2008-10-13 16:52:59.793 Waiting for the server to continue with the initialisation
. 2008-10-13 16:52:59.793 Looking for incoming data
. 2008-10-13 16:52:59.793 Looking for network events
. 2008-10-13 16:52:59.793 Detected network event
. 2008-10-13 16:52:59.793 Enumerating network events for socket 1692
. 2008-10-13 16:52:59.793 Enumerated 18 network events making 18 cumulative events for socket 1692
. 2008-10-13 16:52:59.793 Handling network write event on socket 1692 with error 0
. 2008-10-13 16:52:59.793 Handling network connect event on socket 1692 with error 0
. 2008-10-13 16:52:59.793 Looking for network events
. 2008-10-13 16:52:59.824 Detected network event
. 2008-10-13 16:52:59.824 Enumerating network events for socket 1692
. 2008-10-13 16:52:59.824 Enumerated 1 network events making 1 cumulative events for socket 1692
. 2008-10-13 16:52:59.824 Handling network read event on socket 1692 with error 0
. 2008-10-13 16:52:59.824 Server version: SSH-2.0-http://3sp.com_Maverick_SSHD
. 2008-10-13 16:52:59.824 We claim version: SSH-2.0-WinSCP_release_4.1.7
. 2008-10-13 16:52:59.824 SSPI: acquired credentials for: Administrator@SINCLU02
. 2008-10-13 16:52:59.824 Constructed service principal name 'host/host.name.ch'
. 2008-10-13 16:52:59.824 GSSKEX disabled: No credentials are available in the security package
 
. 2008-10-13 16:52:59.824 Using SSH protocol version 2
. 2008-10-13 16:52:59.824 Waiting for the server to continue with the initialisation
. 2008-10-13 16:52:59.824 Looking for incoming data
. 2008-10-13 16:52:59.824 Looking for network events
. 2008-10-13 16:52:59.855 Detected network event
. 2008-10-13 16:52:59.855 Enumerating network events for socket 1692
. 2008-10-13 16:52:59.855 Enumerated 1 network events making 1 cumulative events for socket 1692
. 2008-10-13 16:52:59.855 Handling network read event on socket 1692 with error 0
. 2008-10-13 16:52:59.855 Using Diffie-Hellman with standard group "group14"
. 2008-10-13 16:52:59.855 Doing Diffie-Hellman key exchange with hash SHA-1
. 2008-10-13 16:52:59.933 Waiting for the server to continue with the initialisation
. 2008-10-13 16:52:59.933 Looking for incoming data
. 2008-10-13 16:52:59.933 Looking for network events
. 2008-10-13 16:53:00.152 Detected network event
. 2008-10-13 16:53:00.152 Enumerating network events for socket 1692
. 2008-10-13 16:53:00.152 Enumerated 1 network events making 1 cumulative events for socket 1692
. 2008-10-13 16:53:00.152 Handling network read event on socket 1692 with error 0
. 2008-10-13 16:53:00.230 Selecting events 63 for socket 1692
. 2008-10-13 16:53:00.230 Host key fingerprint is:
. 2008-10-13 16:53:00.230 ssh-rsa 2048 96:65:04:b9:9f:19:1c:cf:c9:91:47:84:35:44:82:7c
. 2008-10-13 16:53:00.230 Initialised AES-256 CBC client->server encryption
. 2008-10-13 16:53:00.230 Initialised HMAC-SHA1 client->server MAC algorithm
. 2008-10-13 16:53:00.230 Waiting for the server to continue with the initialisation
. 2008-10-13 16:53:00.230 Looking for incoming data
. 2008-10-13 16:53:00.230 Looking for network events
. 2008-10-13 16:53:00.246 Detected network event
. 2008-10-13 16:53:00.246 Enumerating network events for socket 1692
. 2008-10-13 16:53:00.246 Enumerated 1 network events making 1 cumulative events for socket 1692
. 2008-10-13 16:53:00.246 Handling network read event on socket 1692 with error 0
. 2008-10-13 16:53:00.246 Initialised AES-256 CBC server->client encryption
. 2008-10-13 16:53:00.246 Initialised HMAC-SHA1 server->client MAC algorithm
. 2008-10-13 16:53:00.246 Waiting for the server to continue with the initialisation
. 2008-10-13 16:53:00.246 Looking for incoming data
. 2008-10-13 16:53:00.246 Looking for network events
. 2008-10-13 16:53:00.324 Detected network event
. 2008-10-13 16:53:00.324 Enumerating network events for socket 1692
. 2008-10-13 16:53:00.324 Enumerated 1 network events making 1 cumulative events for socket 1692
. 2008-10-13 16:53:00.324 Handling network read event on socket 1692 with error 0
! 2008-10-13 16:53:00.324 Using username "xxxxxx".
. 2008-10-13 16:53:00.324 Waiting for the server to continue with the initialisation
. 2008-10-13 16:53:00.324 Looking for incoming data
. 2008-10-13 16:53:00.324 Looking for network events
. 2008-10-13 16:53:00.339 Detected network event
. 2008-10-13 16:53:00.339 Enumerating network events for socket 1692
. 2008-10-13 16:53:00.339 Enumerated 1 network events making 1 cumulative events for socket 1692
. 2008-10-13 16:53:00.339 Handling network read event on socket 1692 with error 0
. 2008-10-13 16:53:00.339 Waiting for the server to continue with the initialisation
. 2008-10-13 16:53:00.339 Looking for incoming data
. 2008-10-13 16:53:00.339 Looking for network events
. 2008-10-13 16:53:00.527 Detected network event
. 2008-10-13 16:53:00.527 Enumerating network events for socket 1692
. 2008-10-13 16:53:00.527 Enumerated 1 network events making 1 cumulative events for socket 1692
. 2008-10-13 16:53:00.527 Handling network read event on socket 1692 with error 0
. 2008-10-13 16:53:00.558 Prompt (6, SSH password, , &Password: )
. 2008-10-13 16:53:00.558 Using stored password.
. 2008-10-13 16:53:00.558 Sent password
. 2008-10-13 16:53:00.558 Waiting for the server to continue with the initialisation
. 2008-10-13 16:53:00.558 Looking for incoming data
. 2008-10-13 16:53:00.558 Looking for network events
. 2008-10-13 16:53:00.699 Detected network event
. 2008-10-13 16:53:00.699 Enumerating network events for socket 1692
. 2008-10-13 16:53:00.699 Enumerated 1 network events making 1 cumulative events for socket 1692
. 2008-10-13 16:53:00.699 Handling network read event on socket 1692 with error 0
! 2008-10-13 16:53:00.699 Access denied
. 2008-10-13 16:53:00.699 Access denied
. 2008-10-13 16:53:00.699 Prompt (6, SSH password, , &Password: )
. 2008-10-13 16:53:00.699 Selecting events 0 for socket 1692
. 2008-10-13 16:53:00.699 Disconnected: Unable to authenticate

Reply with quote E-mail

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: special characters in password

In the script you have
open xxxxxx:mypasswd@host.name.ch

But in the log I can see
. 2008-10-13 16:52:59.746 Session name: mysession

So it does not look like it is log for the script.

Reply with quote

fima62
Joined:
Posts:
6

Re: special characters in password

Hello,
as described both (saved session and script) are asking me for the password.

Here the last test with my saved session Posta using a batch file
prova1.bat (winscp.exe Posta /console /script=prova1.txt /log=prova1.log)
and prova1.txt is:
option batch on
option confirm off
cd /ega-b-t
ls
close
exit
This is the prova1.log:
. 2008-10-15 16:37:02.701 --------------------------------------------------------------------------
. 2008-10-15 16:37:02.701 WinSCP Versione 4.1.7 (Build 413) (OS 5.1.2600 Service Pack 3)
. 2008-10-15 16:37:02.701 Login time: mercoledì, 15. ottobre 2008 16:37:02
. 2008-10-15 16:37:02.701 --------------------------------------------------------------------------
. 2008-10-15 16:37:02.701 Session name: Posta
. 2008-10-15 16:37:02.701 Host name: host.name.ch (Port: 22)
. 2008-10-15 16:37:02.701 User name: xxxxxx (Password: Yes, Key file: Yes)
. 2008-10-15 16:37:02.701 Tunnel: No
. 2008-10-15 16:37:02.701 Transfer Protocol: SFTP (SCP)
. 2008-10-15 16:37:02.701 Ping type: -, Ping interval: 30 sec; Timeout: 15 sec
. 2008-10-15 16:37:02.701 Proxy: none
. 2008-10-15 16:37:02.701 SSH protocol version: 2; Compression: No
. 2008-10-15 16:37:02.701 Bypass authentication: No
. 2008-10-15 16:37:02.717 Try agent: Yes; Agent forwarding: No; TIS/CryptoCard: No; KI: Yes; GSSAPI: No
. 2008-10-15 16:37:02.717 Ciphers: aes,blowfish,3des,WARN,arcfour,des; Ssh2DES: No
. 2008-10-15 16:37:02.717 SSH Bugs: -,-,-,-,-,-,-,-
. 2008-10-15 16:37:02.717 SFTP Bugs: -,-
. 2008-10-15 16:37:02.717 Return code variable: Autodetect; Lookup user groups: Yes
. 2008-10-15 16:37:02.717 Shell: default, EOL: 0
. 2008-10-15 16:37:02.717 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes
. 2008-10-15 16:37:02.717 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No
. 2008-10-15 16:37:02.717 Local directory: C:\Posta, Remote directory: /, Update: No, Cache: Yes
. 2008-10-15 16:37:02.717 Cache directory changes: Yes, Permanent: Yes
. 2008-10-15 16:37:02.717 DST mode: 1
. 2008-10-15 16:37:02.717 --------------------------------------------------------------------------
. 2008-10-15 16:37:02.717 Looking up host "host.name.ch"
. 2008-10-15 16:37:02.748 Connecting to xxx.xx.xxx.xxx port 22
. 2008-10-15 16:37:02.842 Server version: SSH-2.0-http://3sp.com_Maverick_SSHD
. 2008-10-15 16:37:02.842 We claim version: SSH-2.0-WinSCP_release_4.1.7
. 2008-10-15 16:37:02.842 SSPI: acquired credentials for: 27@mydomain.CH
. 2008-10-15 16:37:02.842 Constructed service principal name 'host/host.name.ch'
. 2008-10-15 16:37:02.842 GSSKEX disabled: The specified target is unknown or unreachable
 
. 2008-10-15 16:37:02.842 Using SSH protocol version 2
. 2008-10-15 16:37:02.920 Using Diffie-Hellman with standard group "group14"
. 2008-10-15 16:37:02.936 Doing Diffie-Hellman key exchange with hash SHA-1
. 2008-10-15 16:37:03.389 Host key fingerprint is:
. 2008-10-15 16:37:03.389 ssh-rsa 2048 96:65:04:b9:9f:19:1c:cf:c9:91:47:84:35:44:82:7c
. 2008-10-15 16:37:03.389 Initialised AES-256 CBC client->server encryption
. 2008-10-15 16:37:03.389 Initialised HMAC-SHA1 client->server MAC algorithm
. 2008-10-15 16:37:03.404 Initialised AES-256 CBC server->client encryption
. 2008-10-15 16:37:03.404 Initialised HMAC-SHA1 server->client MAC algorithm
. 2008-10-15 16:37:03.420 Reading private key file "D:\Program Files\WinSCP\PuTTY\Sempione-Private-key.ppk"
! 2008-10-15 16:37:03.420 Using username "xxxxxx".
. 2008-10-15 16:37:03.576 Offered public key
. 2008-10-15 16:37:03.654 Offer of public key accepted
! 2008-10-15 16:37:03.654 Authenticating with public key "rsa-key-20081007"
. 2008-10-15 16:37:03.654 Prompt (2, SSH key passphrase, , Passphrase for key "rsa-key-20081007": )
. 2008-10-15 16:37:14.716 Access granted
. 2008-10-15 16:37:14.778 Opened channel for session
. 2008-10-15 16:37:14.856 Started a shell/command
. 2008-10-15 16:37:14.856 --------------------------------------------------------------------------
. 2008-10-15 16:37:14.856 Using SFTP protocol.
. 2008-10-15 16:37:14.856 Doing startup conversation with host.
> 2008-10-15 16:37:14.856 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2008-10-15 16:37:15.075 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2008-10-15 16:37:15.075 SFTP version 3 negotiated.
. 2008-10-15 16:37:15.075 We believe the server has signed timestamps bug
. 2008-10-15 16:37:15.075 We will use UTF-8 strings for status messages only
. 2008-10-15 16:37:15.075 Changing directory to "/".
. 2008-10-15 16:37:15.075 Getting real path for '/'
> 2008-10-15 16:37:15.075 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2008-10-15 16:37:15.169 Type: SSH_FXP_NAME, Size: 51, Number: 16
. 2008-10-15 16:37:15.169 Real path is '/'
. 2008-10-15 16:37:15.169 Trying to open directory "/".
> 2008-10-15 16:37:15.169 Type: SSH_FXP_LSTAT, Size: 10, Number: 263
< 2008-10-15 16:37:15.278 Type: SSH_FXP_ATTRS, Size: 37, Number: 263
. 2008-10-15 16:37:15.278 Getting current directory name.
. 2008-10-15 16:37:15.278 Startup conversation with host finished.
. 2008-10-15 16:37:15.278 Changing directory to "/ega-b-t".
. 2008-10-15 16:37:15.278 Getting real path for '/ega-b-t'
> 2008-10-15 16:37:15.278 Type: SSH_FXP_REALPATH, Size: 17, Number: 528
< 2008-10-15 16:37:15.388 Type: SSH_FXP_NAME, Size: 65, Number: 528
. 2008-10-15 16:37:15.388 Real path is '/ega-b-t'
. 2008-10-15 16:37:15.388 Trying to open directory "/ega-b-t".
> 2008-10-15 16:37:15.388 Type: SSH_FXP_LSTAT, Size: 17, Number: 775
< 2008-10-15 16:37:15.481 Type: SSH_FXP_ATTRS, Size: 37, Number: 775
. 2008-10-15 16:37:15.481 Getting current directory name.
. 2008-10-15 16:37:15.481 Listing directory "/ega-b-t".
> 2008-10-15 16:37:15.481 Type: SSH_FXP_OPENDIR, Size: 17, Number: 1035
< 2008-10-15 16:37:15.638 Type: SSH_FXP_HANDLE, Size: 10, Number: 1035
> 2008-10-15 16:37:15.638 Type: SSH_FXP_READDIR, Size: 10, Number: 1292
< 2008-10-15 16:37:15.809 Type: SSH_FXP_NAME, Size: 233, Number: 1292
> 2008-10-15 16:37:15.809 Type: SSH_FXP_READDIR, Size: 10, Number: 1548
< 2008-10-15 16:37:15.903 Type: SSH_FXP_STATUS, Size: 52, Number: 1548
< 2008-10-15 16:37:15.903 Status/error code: 1
> 2008-10-15 16:37:15.903 Type: SSH_FXP_CLOSE, Size: 10, Number: 1796
. 2008-10-15 16:37:15.903 Closing connection.
. 2008-10-15 16:37:15.903 Sending special code: 12
. 2008-10-15 16:37:15.903 Sent EOF message
Thanks for your help
Marco

Reply with quote E-mail

Advertisement

martin
Site Admin
martin avatar

Re: special characters in password

Every time, there's something different in you posts.
This time you authenticate with encrypted private key. So WinSCP asks for its passphrase. That is not a password! Please read FAQ. If that does not help, come back.

Reply with quote

Advertisement

You can post new topics in this forum