Topic "Cannot login"

Author Message
Sokoban
[View user's profile]

Joined: 2009-12-30
Posts: 5
Location: Trondheim
Hi
I have a problem with WinSCP in script mode.
I want the script will login without password. I have the code,
Winscp.exe /console /command "option batch on" "open scp://username:@ip-adress:22 -privatekey=rsa.ppk" "exit"

I got the error messages --> Unable to use the key file rsa.ppk (unable to open file)

The DOS prompt is waiting for a typing the password.. The key (rsa.ppk) doesen't contain a password and I want a automatic login without password.

Please help me !!

Sokoban
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
As you can see in the error message, WinSCP was not able to open the rsa.ppk file. Are you sure it is located in the same directory, where WinSCP is started from? Try to use full path instead.
_________________
Martin Prikryl
Sokoban
[View user's profile]

Joined: 2009-12-30
Posts: 5
Location: Trondheim
Hei .. The log files
*******************************
Looking up host "xxx.xxx.xxx.xxx"
. 2009-12-31 09:23:19.723 Connecting to xxx.xxx.xxx.xxx port 22
. 2009-12-31 09:23:19.895 Server version: SSH-2.0-http://3sp.com_Maverick_SSHD
. 2009-12-31 09:23:19.895 We claim version: SSH-2.0-WinSCP_release_4.1.8
. 2009-12-31 09:23:19.942 SSPI: acquired credentials for: xxxxxxxxxxxx@xxxx.no
. 2009-12-31 09:23:19.942 Cannot convert IP address to SPN: DNS is not trusted
. 2009-12-31 09:23:19.942 GSSKEX disabled: The operation completed successfully.

. 2009-12-31 09:23:19.942 Using SSH protocol version 2
. 2009-12-31 09:23:20.005 Using Diffie-Hellman with standard group "group14"
. 2009-12-31 09:23:20.005 Doing Diffie-Hellman key exchange with hash SHA-1
. 2009-12-31 09:23:21.567 Host key fingerprint is:
. 2009-12-31 09:23:21.567 ssh-rsa 1024 03:33:65:d0:b9:75:9c:a0:09:47:2a:c2:31:d3:58:08
. 2009-12-31 09:23:21.567 Initialised AES-256 CBC client->server encryption
. 2009-12-31 09:23:21.567 Initialised HMAC-SHA1 client->server MAC algorithm
. 2009-12-31 09:23:21.583 Initialised AES-256 CBC server->client encryption
. 2009-12-31 09:23:21.583 Initialised HMAC-SHA1 server->client MAC algorithm
. 2009-12-31 09:23:21.708 Reading private key file "W:\BBS\rsa.ppk"
! 2009-12-31 09:23:21.708 Using username "***".
. 2009-12-31 09:23:21.927 Offered public key
. 2009-12-31 09:23:22.192 Offer of public key accepted
! 2009-12-31 09:23:22.192 Authenticating with public key "rsa-key-20091218"
. 2009-12-31 09:23:22.583 Access granted
. 2009-12-31 09:23:22.693 Opened channel for session
. 2009-12-31 09:23:22.802 Server refused to start a shell/command
**********

. 2009-12-31 09:09:26.272 Using SFTP protocol.
. 2009-12-31 09:09:26.272 Doing startup conversation with host.
> 2009-12-31 09:09:26.272 Type: SSH_FXP_INIT, Size: 5, Number: -1
< 2009-12-31 09:09:26.585 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2009-12-31 09:09:26.585 SFTP version 3 negotiated.
. 2009-12-31 09:09:26.585 We believe the server has signed timestamps bug
. 2009-12-31 09:09:26.585 We will use UTF-8 strings for status messages only
. 2009-12-31 09:09:26.585 Getting current directory name.
. 2009-12-31 09:09:26.585 Getting real path for '.'
> 2009-12-31 09:09:26.585 Type: SSH_FXP_REALPATH, Size: 10, Number: 16
< 2009-12-31 09:09:26.694 Type: SSH_FXP_NAME, Size: 51, Number: 16
. 2009-12-31 09:09:26.694 Real path is '/'
. 2009-12-31 09:09:26.694 Listing directory "/".
> 2009-12-31 09:09:26.694 Type: SSH_FXP_OPENDIR, Size: 10, Number: 267
< 2009-12-31 09:09:26.804 Type: SSH_FXP_HANDLE, Size: 10, Number: 267
> 2009-12-31 09:09:26.804 Type: SSH_FXP_READDIR, Size: 10, Number: 524
< 2009-12-31 09:09:27.054 Type: SSH_FXP_NAME, Size: 229, Number: 524
> 2009-12-31 09:09:27.054 Type: SSH_FXP_READDIR, Size: 10, Number: 780
< 2009-12-31 09:09:27.147 Type: SSH_FXP_STATUS, Size: 45, Number: 780
< 2009-12-31 09:09:27.147 Status/error code: 1
> 2009-12-31 09:09:27.147 Type: SSH_FXP_CLOSE, Size: 10, Number: 1028
. 2009-12-31 09:09:27.147 Startup conversation with host finished.
. 2009-12-31 09:09:29.757 Cached directory change via "Inbound" to "/Inbound".
. 2009-12-31 09:09:29.757 Getting current directory name.
. 2009-12-31 09:09:29.757 Listing directory "/Inbound".
> 2009-12-31 09:09:29.757 Type: SSH_FXP_OPENDIR, Size: 17, Number: 1291
< 2009-12-31 09:09:29.757 Type: SSH_FXP_STATUS, Size: 40, Number: 1028
. 2009-12-31 09:09:29.757 Discarding reserved response
< 2009-12-31 09:09:30.038 Type: SSH_FXP_HANDLE, Size: 10, Number: 1291
> 2009-12-31 09:09:30.038 Type: SSH_FXP_READDIR, Size: 10, Number: 1548
< 2009-12-31 09:09:30.366 Type: SSH_FXP_NAME, Size: 128, Number: 1548
> 2009-12-31 09:09:30.366 Type: SSH_FXP_READDIR, Size: 10, Number: 1804
< 2009-12-31 09:09:30.476 Type: SSH_FXP_STATUS, Size: 52, Number: 1804
< 2009-12-31 09:09:30.476 Status/error code: 1
> 2009-12-31 09:09:30.476 Type: SSH_FXP_CLOSE, Size: 10, Number: 2052
. 2009-12-31 09:09:34.179 Closing connection.
. 2009-12-31 09:09:34.179 Sending special code: 12
. 2009-12-31 09:09:34.179 Sent EOF message

I have now the path for the key but I have still problem to login and upload the file to the remote WINSCP path. It works with WINSCP application...


******* The code

V:
cd %PROGRAMFILES%\WinSCP
winscp.exe /console /command "option batch on" "open scp://Username:@xx.xx.xx.xx:22 -privatekey=W:\BBS\rsa.ppk" "EXIT"
cd /inbound
put \\Remote path\Test 2009-12-31.txt


Can you help me ?

// Sokoban
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
In the script you seem to use SCP, while in GUI you use SFTP.
_________________
Martin Prikryl
Sokoban
[View user's profile]

Joined: 2009-12-30
Posts: 5
Location: Trondheim
prikryl wrote:
In the script you seem to use SCP, while in GUI you use SFTP.


Thanks again, I have now a little problem ... How I do to add exit in that command ?

winscp.exe /console /command "option batch on" "open sftp://xxxxx:@xxx.xxx.xxx.xxx:22 -privatekey=W:\BBS\rsa.ppk" "put -nopreservetime -nopermissions "Z:\Til_BBS" "\Inbound"

I have add the command "exit" without success.. Please help me!!

// sokoban Laughing
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
This command should do:
winscp.exe /console /command "option batch on" "open sftp://xxxxx:@xxx.xxx.xxx.xxx:22 -privatekey=W:\BBS\rsa.ppk" "put -nopreservetime -nopermissions Z:\Til_BBS \Inbound" "exit"
_________________
Martin Prikryl
Sokoban
[View user's profile]

Joined: 2009-12-30
Posts: 5
Location: Trondheim
prikryl wrote:
This command should do:
winscp.exe /console /command "option batch on" "open sftp://xxxxx:@xxx.xxx.xxx.xxx:22 -privatekey=W:\BBS\rsa.ppk" "put -nopreservetime -nopermissions Z:\Til_BBS \Inbound" "exit"


No it dosen't works.. It works with *****_BBS \Inbound"" exit
Add a quotation mark and you have to delete the quotation mark around the exit

Thanks for you help !! Smile
// Sokoban
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License