Mani
Mani

Reputation: 197

WinSCP.com Access is denied with a pre-entered password but working manually

I am trying to write a script to automatically download a file from my sftp server. When I use the following command in winscp.com:

open user:password@sftpserver 

I am receiving:

Access denied.

Same password is working when I login manually.

Upvotes: 1

Views: 12083

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202652

This is typically caused by some special character in the password that has a specific meaning in the session URL.

Such characters has to be URL-encoded. For example the @ has to be encoded as the %40.

See a list of special characters that needs to be URL-encoded in WinSCP URL.

Alternatively, since WinSCP 5.19, you can use -username and -password switches, which do not need any encoding.


If that does not help, enable logging both for the script (the /log command-line switch) and a manual login. And compare the logs. You can also enable password logging to see the actual password used for the authentication.


There's also an entire FAQ on WinSCP site covering Why I cannot connect/transfer using script, when I can using GUI?


Side note: You should better specify a protocol in the URL:

open sftp://user:password@sftpserver 

Upvotes: 1

Related Questions