Your shell is probably incompatible with the application (BASH is recommended)

Advertisement

Ayudo98
Joined:
Posts:
5
Location:
US

Your shell is probably incompatible with the application (BASH is recommended)

Hello,

I have a PowerShell script. I am using SFTP.
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
    Protocol = [WinSCP.Protocol]::Sftp
    HostName = $hostname
    UserName = $config.Configuration.UserName
    SecurePassword = ConvertTo-SecureString $config.Configuration.Password 
}
The default shell in the target host is ksh. I want to execute a command:
$Command = "ls -ltr"
$output = $session.ExecuteCommand($Command)
I get this error:
Your shell is probably incompatible with the application (BASH is recommended)
If I execute this command against a host where the default shell is /bin/bash, it works.

Question is: How can I direct SFTP to use ksh as the shell for the command execution?

Note:
I cannot change the default host from ksh to bash because it is a company policy and I have hundreds of hosts.

-rawsettings option shell, the documentation states is only for SCP protocol
https://winscp.net/eng/docs/rawsettings
Shell (SCP protocol)

In this post (Connection has been unexpectedly closed. Server sent command), someone suggested he/she can change the shell:
Oh, you know, looking through the options I changed the shell to /bin/ksh and it worked.
but does not explain how.

Regards, Raul.

Reply with quote

Advertisement

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

Re: Your shell is probably incompatible with the application (BASH is recommended)

You cannot use ksh, that's the point. You have to use bash.
Use the Shell raw site settings to force bash instead of the default ksh.

Reply with quote

Advertisement

You can post new topics in this forum