-
Notifications
You must be signed in to change notification settings - Fork 778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sshd_config doesn't seem to respect "-NoLogo -NoProfile" #1677
Comments
|
PS2.
Where I used one of: Set-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH\" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"
# or this:
Set-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Program Files\PowerShell\7\pwsh.exe"^^^ This is where I also tried to hardlink (or softlink) the pwsh.exe to |
|
This issue is related to #784, as Win32-OpenSSH is not able to distinguish between spaces in a Path and spaced separating command options, leading to erroneous behavior when setting the registry items for default shell and command options. As one of the powershell developers said:
|
|
@bagajjal Set-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Program Files\PowerShell\7\pwsh.exe"
Set-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShellCommandOption -Value "-NoLogo -NoProfile -c"Where the
|
|
Some further research, it seems like The subsystem part is fine, that's doing exactly what it's meant to and is unrelated to opening a normal ssh connection using the |
|
I think I've found the problem, the buffer that is used to store
This could also be done with
Finally I don't believe |
Yes, that is a series of unfortunate events, as most SFTP servers are using exactly that to do SCP access via SSH, not expecting any other garbage, while not being able to modify the FTP connection strings in such a way to do: So is there a way or work-around for detecting if my PS. Thank you! I really appreciate your investigation and looking into this issue. 💯 |
|
I think you can do something like create a batch file that contains |
|
/cc @PaulHigin Could you please weight @jborean93's investigations? |
|
@jborean93 Set-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShellCommandOption -Value "-nol -nop -c"Because
Can I set that to any file, like |
Yes but only for non-interactive ssh commands like If you want this to be applied to an interactive session then you need to create a bat file with the command you want to run and set |
|
I just tried using "-nol -nop -c" with |
|
I don't understand what is trying to be accomplished here. The PowerShell -sshs switch should only be used to run PowerShell in remoting SSH server mode. It is specific only to PowerShell remoting and does not start a normal PowerShell interactive shell. Instead it runs in server mode that handles PSRP messages through stdIn/stdOut. |
|
@PaulHigin I could be wrong here but I don't think
My suggestion was to create a batch file with the contents and set that btch file as the In my testing this works perfectly for interactive logons and achieves what I think OP is trying to do. Anything else would require further changes in the OpenSSH code. The hard limit for |
Hi Paul, |
|
@eabase - I tested with OpenSSH V8.1 and it works as expected. My sshd_config has Please note DefaultShellCommandOption is intended to specify the shell command argument. If you want to have the similar experience without a setting up subsystem in sshd_config then try the attached private sshd binary. These changes will be part of next release openssh v8.5. You need to populate the registry entries |
|
Just got around to test this out and it looks like Is there a reason at all to split |
|
@bagajjal - Do we have any chances to get In my opinion it is even more important to not load a user profile and not showing the copyright banner when executing a command via SSH than when working on an interactive SSH session. |
I added |



I also tried creating both SymbolicLink and HardLink to pwsh.exe and even via Registry edit, but all to no avail. For some reason the OpenSSH sshd_config, never respects the
-NoLogo -NoProfilewhen starting the Subsystem"OpenSSH for Windows" version
7.7.2.2
Server OperatingSystems
Client OperatingSystem
I tried both:
What is failing
The sshd_config subsystem item:
Subsystem pwsh c:/progra~1/powershell/7/pwsh.exe -NoLogo -NoProfile -sshsExpected output
Login shell without Logo and without running my [powershell] profile(s).
Actual output
With the current setting above and registry items (from below) I still get the output:
...and dumping me into:
PowerShell Version : 5.1.18362.1110PS. I already tried things like:
I have also tried with (and without) setting:
The text was updated successfully, but these errors were encountered: