Authentication failed with powershell but is OK with gui or command

Advertisement

miniil
Joined:
Posts:
1
Location:
Belgium

Authentication failed with powershell but is OK with gui or command

Hi,

All is in the title :) Authentication failed with powershell but is ok with gui or command mode.

I generate de script from gui and here it is :

$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
    Protocol = [WinSCP.Protocol]::Ftp
    HostName = "10.10.138.84"
    PortNumber = 21
    UserName = "username"
    Password = "password"
}

$session = New-Object WinSCP.Session

try
{
    # Connect
    $session.Open($sessionOptions)

    # Your code
}
finally
{
    $session.Dispose()
}

I just replace username and password to not share.

Here is my log from gui

. 2016-07-12 12:05:35.527 --------------------------------------------------------------------------
. 2016-07-12 12:05:35.527 WinSCP Version 5.8.4 RC (Build 6736) (OS 6.1.7601 Service Pack 1 - Windows 7 Professional)
. 2016-07-12 12:05:35.527 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2016-07-12 12:05:35.527 Log level: Normal, Logging passwords
. 2016-07-12 12:05:35.528 Local account: *****
. 2016-07-12 12:05:35.528 Working directory: C:\Program Files (x86)\WinSCP
. 2016-07-12 12:05:35.528 Process ID: 8860
. 2016-07-12 12:05:35.528 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" 
. 2016-07-12 12:05:35.528 Time zone: Current: GMT+2, Standard: GMT+1 (Paris, Madrid), DST: GMT+2 (Paris, Madrid (heure d’été)), DST Start: 27/03/2016, DST End: 30/10/2016
. 2016-07-12 12:05:35.528 Login time: mardi 12 juillet 2016 12:05:35
. 2016-07-12 12:05:35.528 --------------------------------------------------------------------------
. 2016-07-12 12:05:35.528 Session name: username@10.10.138.84 (Ad-Hoc site)
. 2016-07-12 12:05:35.528 Host name: 10.10.138.84 (Port: 21)
. 2016-07-12 12:05:35.528 User name: username(Password: password, Key file: No)
. 2016-07-12 12:05:35.528 Transfer Protocol: FTP
. 2016-07-12 12:05:35.528 Ping type: Dummy, Ping interval: 30 sec; Timeout: 15 sec
. 2016-07-12 12:05:35.528 Disable Nagle: No
. 2016-07-12 12:05:35.528 Proxy: None
. 2016-07-12 12:05:35.528 Send buffer: 262144
. 2016-07-12 12:05:35.528 UTF: Auto
. 2016-07-12 12:05:35.528 FTPS: None [Client certificate: No]
. 2016-07-12 12:05:35.528 FTP: Passive: Yes [Force IP: Auto]; MLSD: Auto [List all: Auto]; HOST: Auto
. 2016-07-12 12:05:35.528 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2016-07-12 12:05:35.528 Cache directory changes: Yes, Permanent: Yes
. 2016-07-12 12:05:35.528 Recycle bin: Delete to: No, Overwritten to: No, Bin path: 
. 2016-07-12 12:05:35.528 Timezone offset: 0h 0m
. 2016-07-12 12:05:35.528 --------------------------------------------------------------------------
. 2016-07-12 12:05:36.128 Connecting to 10.10.138.84 ...
. 2016-07-12 12:05:36.128 Connected with 10.10.138.84. Waiting for welcome message...
< 2016-07-12 12:05:36.128 220 -
> 2016-07-12 12:05:36.128 USER username
< 2016-07-12 12:05:36.128 331 User username, password please
> 2016-07-12 12:05:36.128 PASS password
< 2016-07-12 12:05:36.128 230 Password Ok, User logged in
> 2016-07-12 12:05:36.128 SYST
< 2016-07-12 12:05:36.128 215 UNIX Type: L8
> 2016-07-12 12:05:36.128 FEAT
< 2016-07-12 12:05:36.128 211- Additional features supported include:
< 2016-07-12 12:05:36.128  MDTM
< 2016-07-12 12:05:36.128  MFCT
< 2016-07-12 12:05:36.128  MFMT
< 2016-07-12 12:05:36.128  SIZE
< 2016-07-12 12:05:36.128  REST STREAM
< 2016-07-12 12:05:36.128  AUTH TLS
< 2016-07-12 12:05:36.128  AUTH SSL
< 2016-07-12 12:05:36.128  PBSZ
< 2016-07-12 12:05:36.128  EPRT
< 2016-07-12 12:05:36.128  EPSV
< 2016-07-12 12:05:36.128  XCRC
< 2016-07-12 12:05:36.129  XSHA1
< 2016-07-12 12:05:36.129  XSHA256
< 2016-07-12 12:05:36.129  XSHA512
< 2016-07-12 12:05:36.129  XMD5
< 2016-07-12 12:05:36.129  PROT
< 2016-07-12 12:05:36.129  LANG EN*
< 2016-07-12 12:05:36.129  SITE CHMOD
< 2016-07-12 12:05:36.129  SITE PSWD
< 2016-07-12 12:05:36.129  SITE ZONE
< 2016-07-12 12:05:36.129  SITE UTIME
< 2016-07-12 12:05:36.129  MLST Type*;Size*;Modify*;Create*;
< 2016-07-12 12:05:36.129  CLNT
< 2016-07-12 12:05:36.129  CSID
< 2016-07-12 12:05:36.129  RMDA
< 2016-07-12 12:05:36.129  UTF8
< 2016-07-12 12:05:36.129 211 End
> 2016-07-12 12:05:36.129 CLNT WinSCP-release-5.8.4
< 2016-07-12 12:05:36.129 200 Command okay
> 2016-07-12 12:05:36.129 OPTS UTF8 ON
< 2016-07-12 12:05:36.129 220 UTF8 support on
. 2016-07-12 12:05:36.181 Connected
. 2016-07-12 12:05:36.182 --------------------------------------------------------------------------
. 2016-07-12 12:05:36.182 Using FTP protocol.
. 2016-07-12 12:05:36.182 Doing startup conversation with host.
> 2016-07-12 12:05:36.235 PWD
< 2016-07-12 12:05:36.242 257 "/" is the current directory
. 2016-07-12 12:05:36.243 Getting current directory name.
. 2016-07-12 12:05:36.389 Retrieving directory listing...
> 2016-07-12 12:05:36.389 TYPE A
< 2016-07-12 12:05:36.396 200 Type ASCII
> 2016-07-12 12:05:36.396 PASV
< 2016-07-12 12:05:36.404 227 Entering Passive Mode (10,10,138,84,50,29)
> 2016-07-12 12:05:36.404 MLSD
. 2016-07-12 12:05:36.404 Connecting to 10.10.138.84:12829 ...
< 2016-07-12 12:05:36.418 150 Opening data connection
. 2016-07-12 12:05:36.419 size=0;modify=20160304132910;create=20140505104401;perm=cmpledf;type=cdir; .
. 2016-07-12 12:05:36.419 size=0;modify=20160304132910;create=20140505104401;perm=cmpledf;type=pdir; ..
. 2016-07-12 12:05:36.419 size=0;modify=20160502135923;create=20141223084037;perm=cmpledf;type=dir; ADMIN
. 2016-07-12 12:05:36.419 size=0;modify=20151223141805;create=20140506041328;perm=cmpledf;type=dir; TECH
< 2016-07-12 12:05:36.619 226 Transfer complete
. 2016-07-12 12:05:36.620 Directory listing successful
. 2016-07-12 12:05:36.620 ..;D;0;1899-12-30T01:00:00.000Z;0;"" [0];"" [0];---------;0
. 2016-07-12 12:05:36.620 ADMIN;D;0;2016-05-02T13:59:23.000Z;3;"" [0];"" [0];---------;0
. 2016-07-12 12:05:36.620 TECH;D;0;2015-12-23T14:18:05.000Z;3;"" [0];"" [0];---------;0
. 2016-07-12 12:05:36.693 Startup conversation with host finished.

and here is the log for powershell

. 2016-07-12 11:37:36.092 --------------------------------------------------------------------------
. 2016-07-12 11:37:36.093 WinSCP Version 5.7.7 (Build 6257) (OS 6.1.7601 Service Pack 1 - Windows 7 Professional)
. 2016-07-12 11:37:36.093 Configuration: Command-line options overriding nul
. 2016-07-12 11:37:36.093 Log level: Normal
. 2016-07-12 11:37:36.093 Local account: ****
. 2016-07-12 11:37:36.093 Working directory: C:****
. 2016-07-12 11:37:36.093 Process ID: 2972
. 2016-07-12 11:37:36.093 Command-line: "C:\****\winscp.exe" /xmllog="C:\Windows\TEMP\wscp0424.020EE677.tmp" /xmlgroups /nointeractiveinput /dotnet=577  /ini=nul /log="C:\****\session.log"  /rawconfig Logging\Logging="1" /console /consoleinstance=_1060_2576192_482
. 2016-07-12 11:37:36.093 Time zone: Current: GMT+2, Standard: GMT+1 (Paris, Madrid), DST: GMT+2 (Paris, Madrid (heure d’été)), DST Start: 27/03/2016, DST End: 30/10/2016
. 2016-07-12 11:37:36.093 Login time: mardi 12 juillet 2016 11:37:36
. 2016-07-12 11:37:36.093 --------------------------------------------------------------------------
. 2016-07-12 11:37:36.093 Script: Retrospectively logging previous script records:
> 2016-07-12 11:37:36.093 Script: option batch on
< 2016-07-12 11:37:36.093 Script: batch           on        
< 2016-07-12 11:37:36.093 Script: reconnecttime   120       
> 2016-07-12 11:37:36.093 Script: option confirm off
< 2016-07-12 11:37:36.094 Script: confirm         off       
> 2016-07-12 11:37:36.094 Script: option reconnecttime 120
< 2016-07-12 11:37:36.094 Script: reconnecttime   120       
> 2016-07-12 11:37:36.094 Script: open ftp://EBOS5VOO001:***@10.15.136.83:21 -passive=1 -timeout=15
. 2016-07-12 11:37:36.094 --------------------------------------------------------------------------
. 2016-07-12 11:37:36.094 Session name: username@110.10.138.84 (Ad-Hoc site)
. 2016-07-12 11:37:36.094 Host name: 10.10.138.84 (Port: 21)
. 2016-07-12 11:37:36.094 User name: username (Password: Yes, Key file: No)
. 2016-07-12 11:37:36.094 Transfer Protocol: FTP
. 2016-07-12 11:37:36.094 Ping type: C, Ping interval: 30 sec; Timeout: 15 sec
. 2016-07-12 11:37:36.094 Disable Nagle: No
. 2016-07-12 11:37:36.094 Proxy: none
. 2016-07-12 11:37:36.094 Send buffer: 262144
. 2016-07-12 11:37:36.094 UTF: 2
. 2016-07-12 11:37:36.094 FTP: FTPS: None; Passive: Yes [Force IP: A]; MLSD: A [List all: A]
. 2016-07-12 11:37:36.094 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2016-07-12 11:37:36.094 Cache directory changes: Yes, Permanent: Yes
. 2016-07-12 11:37:36.094 Timezone offset: 0h 0m
. 2016-07-12 11:37:36.094 --------------------------------------------------------------------------
. 2016-07-12 11:37:36.099 Connecting to 10.10.138.84 ...
. 2016-07-12 11:37:36.107 Connected with 10.10.138.84. Waiting for welcome message...
< 2016-07-12 11:37:36.114 220 -
> 2016-07-12 11:37:36.114 USER username
< 2016-07-12 11:37:36.122 331 User username, password please
> 2016-07-12 11:37:36.122 PASS *****
< 2016-07-12 11:37:39.140 530 Not logged in. Username/password incorrect, user disabled, or user logged in too many times
. 2016-07-12 11:37:39.140 Connection failed.
. 2016-07-12 11:37:39.141 Password prompt (last login attempt failed)


I tried to close all other connection, but it failed.
The only special character in password is $

Thanks for your help.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: Authentication failed with powershell but is OK with gui or command

Don't you have some special character in your password or username?

Reply with quote

Advertisement

You can post new topics in this forum