Configure default shell initialized by OpenSSH on Windows 7
Is there a way to configure OpenSSH on Windows 7 in to initialize another shell other than the default Windows command shell?
me@linuxhost:~
$ ssh me@windowshost
me@windowshost's password:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
me@windowshost C:Usersme> exit
Connection to windowshost closed.
me@linuxhost:~
$
Alternately, installing Cygwin and including OpenSSH in the additional Net packages results in a default Cygwin shell, so the same question stands: is there a way to configure the shell initialized by OpenSSH after installation?
EDIT:
Thank you @simlev for your suggestion to use Cygwin I have reworded my question to more clearly represent my problem.
ssh openssh sshd
add a comment |
Is there a way to configure OpenSSH on Windows 7 in to initialize another shell other than the default Windows command shell?
me@linuxhost:~
$ ssh me@windowshost
me@windowshost's password:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
me@windowshost C:Usersme> exit
Connection to windowshost closed.
me@linuxhost:~
$
Alternately, installing Cygwin and including OpenSSH in the additional Net packages results in a default Cygwin shell, so the same question stands: is there a way to configure the shell initialized by OpenSSH after installation?
EDIT:
Thank you @simlev for your suggestion to use Cygwin I have reworded my question to more clearly represent my problem.
ssh openssh sshd
You can do this easier with a dedicated tool. See for example if you like Gitblit.
– harrymc
Feb 27 '17 at 20:26
add a comment |
Is there a way to configure OpenSSH on Windows 7 in to initialize another shell other than the default Windows command shell?
me@linuxhost:~
$ ssh me@windowshost
me@windowshost's password:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
me@windowshost C:Usersme> exit
Connection to windowshost closed.
me@linuxhost:~
$
Alternately, installing Cygwin and including OpenSSH in the additional Net packages results in a default Cygwin shell, so the same question stands: is there a way to configure the shell initialized by OpenSSH after installation?
EDIT:
Thank you @simlev for your suggestion to use Cygwin I have reworded my question to more clearly represent my problem.
ssh openssh sshd
Is there a way to configure OpenSSH on Windows 7 in to initialize another shell other than the default Windows command shell?
me@linuxhost:~
$ ssh me@windowshost
me@windowshost's password:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
me@windowshost C:Usersme> exit
Connection to windowshost closed.
me@linuxhost:~
$
Alternately, installing Cygwin and including OpenSSH in the additional Net packages results in a default Cygwin shell, so the same question stands: is there a way to configure the shell initialized by OpenSSH after installation?
EDIT:
Thank you @simlev for your suggestion to use Cygwin I have reworded my question to more clearly represent my problem.
ssh openssh sshd
ssh openssh sshd
edited Feb 28 '17 at 17:58
mlegge
asked Feb 24 '17 at 21:35
mleggemlegge
7319
7319
You can do this easier with a dedicated tool. See for example if you like Gitblit.
– harrymc
Feb 27 '17 at 20:26
add a comment |
You can do this easier with a dedicated tool. See for example if you like Gitblit.
– harrymc
Feb 27 '17 at 20:26
You can do this easier with a dedicated tool. See for example if you like Gitblit.
– harrymc
Feb 27 '17 at 20:26
You can do this easier with a dedicated tool. See for example if you like Gitblit.
– harrymc
Feb 27 '17 at 20:26
add a comment |
3 Answers
3
active
oldest
votes
Win32-OpenSSH hardcodes cmd.exe as the default shell in the source: see lines 978-984 and 1081-1086 of shell-host.c. With that said, it appears the only way to change the default shell is to change it in those locations and recompile OpenSSH.
With Powershell being under heavy development, things have changed: see Brethlosze's recent answer.
– simlev
Jan 23 at 18:03
add a comment |
My warm recommendation is to use Cygwin to accept ssh connections on your Windows machine. This would allow you to scp to and from it, as well as login from a remote system via ssh to a Bash shell and command-line git.
user@linuxhost$ ssh 192.168.x.x
Last login: Sun Feb 12 08:20:07 2017 from 10.x.x.x
user@windowshost$ echo $0 && git --version
-bash
git version 2.8.3
The shell can of course be customized: ash, bash, dash and sh are included by default, but just run the Cygwin installer and you can add your choice of zsh, mksh, tcsh or posh. Then add the following line to /etc/nsswitch.conf
:
db_shell: /bin/sh
possibly substituting /usr/bin/sh
with the path to your preferred shell. All Cygwin processes (terminal windows and sshd service) must be restarted for the setting to take effect.
There is even a way to get a cmd or powershell prompt upon login, which I recently found out about on Stackoverflow.
- Download winpty for Cygwin and extract
winpty.exe
,winpty.dll
andwinpty-agent.exe
to/bin
. If you do this from outside of a Cygwin terminal, look for abin
subdirectory of the Cygwin installation folder.
Create two batch files in
/bin
and make sure they have execute permissions. Let's name them winpty-cmd.bat and winpty-powershell.bat and fill them with the following contents, where of course<cygwin path>
is a placeholder for the path you installed Cygwin to (by default it'sC:cygwin
):
@ECHO OFF
<cygwin path>binwinpty.exe cmd
and
@ECHO OFF
<cygwin path>binwinpty.exe powershell
Put one of these lines into
/etc/nsswitch.conf
:
db_shell: /bin/winpty-cmd.bat
or
db_shell: /bin/winpty-powershell.bat
- Restart the sshd service.
Since the title has been "reworded" and my post might now seem sligthly out of place, allow me to directly answer the original question:
"Use git bash instead of cmd when sshing from Linux"
In addition to using Cygwin to accept ssh connections on the Windows machine:
- Follow step
1.
above.
Create a file called
<cygwin path>binwinpty-gitbash.bat
with these contents, where<cygwin path>
is a placeholder for the path you installed git-for-windows to (by default it'sC:Program FilesGit
):
@ECHO OFF
SET PATH="/bin"
<cygwin path>binwinpty.exe "<git path>binbash.exe"
Put this line into
/etc/nsswitch.conf
:
db_shell: /bin/winpty-gitbash.bat
- Restart the sshd service.
Update - September 2018:
Things change, and Win32-OpenSSH now allows choosing the default shell (any shell actually) by setting its path in a registry key. See Brethlosze's recent answer.
This does not make use of the tools you mention (OpenSSH and Git Bash) but allows you to reach your goals (scp, Bash).
– simlev
Feb 27 '17 at 19:35
add a comment |
According to this you can configure the DefaultShell for OpenSSH in Windows, to be PowerShell or any other executable.
It requires to add the String Registry Key ComputerHKEY_LOCAL_MACHINESOFTWAREOpenSSHDefaultShell
with the path of the Shell Executable as string value, i.e.:
Powershell: C:WindowsSystem32WindowsPowerShellv1.0powershell.exe
CygWin Bash: C:Cygwin64binbash.exe
I tested it and works as expected.
From the Win32-OpenSSH wiki:
On the server side, configure the default ssh shell in the windows
registry.
ComputerHKEY_LOCAL_MACHINESOFTWAREOpenSSHDefaultShell
- full path of the shell executable
ComputerHKEY_LOCAL_MACHINESOFTWAREOpenSSHDefaultShellCommandOption
(optional) - switch that the configured default shell requires to
execute a command, immediately exit and return to the calling process.
By default this is-c
.
ComputerHKEY_LOCAL_MACHINESOFTWAREOpenSSHDefaultShellEscapeArguments
(optional) - flag that allow you to skip escaping the arguments of
default shell. By default this is0
. This option is only applicable to
shells other than powershell, powershell, bash, cygwin, cmd, and
ssh-shellhost.exe.
1
Thank you, I like this! The page you link to was first created on 13 Sep 2018, it was about time!
– simlev
Jan 23 at 17:57
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1182522%2fconfigure-default-shell-initialized-by-openssh-on-windows-7%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Win32-OpenSSH hardcodes cmd.exe as the default shell in the source: see lines 978-984 and 1081-1086 of shell-host.c. With that said, it appears the only way to change the default shell is to change it in those locations and recompile OpenSSH.
With Powershell being under heavy development, things have changed: see Brethlosze's recent answer.
– simlev
Jan 23 at 18:03
add a comment |
Win32-OpenSSH hardcodes cmd.exe as the default shell in the source: see lines 978-984 and 1081-1086 of shell-host.c. With that said, it appears the only way to change the default shell is to change it in those locations and recompile OpenSSH.
With Powershell being under heavy development, things have changed: see Brethlosze's recent answer.
– simlev
Jan 23 at 18:03
add a comment |
Win32-OpenSSH hardcodes cmd.exe as the default shell in the source: see lines 978-984 and 1081-1086 of shell-host.c. With that said, it appears the only way to change the default shell is to change it in those locations and recompile OpenSSH.
Win32-OpenSSH hardcodes cmd.exe as the default shell in the source: see lines 978-984 and 1081-1086 of shell-host.c. With that said, it appears the only way to change the default shell is to change it in those locations and recompile OpenSSH.
answered Mar 2 '17 at 5:10
Joseph SibleJoseph Sible
991114
991114
With Powershell being under heavy development, things have changed: see Brethlosze's recent answer.
– simlev
Jan 23 at 18:03
add a comment |
With Powershell being under heavy development, things have changed: see Brethlosze's recent answer.
– simlev
Jan 23 at 18:03
With Powershell being under heavy development, things have changed: see Brethlosze's recent answer.
– simlev
Jan 23 at 18:03
With Powershell being under heavy development, things have changed: see Brethlosze's recent answer.
– simlev
Jan 23 at 18:03
add a comment |
My warm recommendation is to use Cygwin to accept ssh connections on your Windows machine. This would allow you to scp to and from it, as well as login from a remote system via ssh to a Bash shell and command-line git.
user@linuxhost$ ssh 192.168.x.x
Last login: Sun Feb 12 08:20:07 2017 from 10.x.x.x
user@windowshost$ echo $0 && git --version
-bash
git version 2.8.3
The shell can of course be customized: ash, bash, dash and sh are included by default, but just run the Cygwin installer and you can add your choice of zsh, mksh, tcsh or posh. Then add the following line to /etc/nsswitch.conf
:
db_shell: /bin/sh
possibly substituting /usr/bin/sh
with the path to your preferred shell. All Cygwin processes (terminal windows and sshd service) must be restarted for the setting to take effect.
There is even a way to get a cmd or powershell prompt upon login, which I recently found out about on Stackoverflow.
- Download winpty for Cygwin and extract
winpty.exe
,winpty.dll
andwinpty-agent.exe
to/bin
. If you do this from outside of a Cygwin terminal, look for abin
subdirectory of the Cygwin installation folder.
Create two batch files in
/bin
and make sure they have execute permissions. Let's name them winpty-cmd.bat and winpty-powershell.bat and fill them with the following contents, where of course<cygwin path>
is a placeholder for the path you installed Cygwin to (by default it'sC:cygwin
):
@ECHO OFF
<cygwin path>binwinpty.exe cmd
and
@ECHO OFF
<cygwin path>binwinpty.exe powershell
Put one of these lines into
/etc/nsswitch.conf
:
db_shell: /bin/winpty-cmd.bat
or
db_shell: /bin/winpty-powershell.bat
- Restart the sshd service.
Since the title has been "reworded" and my post might now seem sligthly out of place, allow me to directly answer the original question:
"Use git bash instead of cmd when sshing from Linux"
In addition to using Cygwin to accept ssh connections on the Windows machine:
- Follow step
1.
above.
Create a file called
<cygwin path>binwinpty-gitbash.bat
with these contents, where<cygwin path>
is a placeholder for the path you installed git-for-windows to (by default it'sC:Program FilesGit
):
@ECHO OFF
SET PATH="/bin"
<cygwin path>binwinpty.exe "<git path>binbash.exe"
Put this line into
/etc/nsswitch.conf
:
db_shell: /bin/winpty-gitbash.bat
- Restart the sshd service.
Update - September 2018:
Things change, and Win32-OpenSSH now allows choosing the default shell (any shell actually) by setting its path in a registry key. See Brethlosze's recent answer.
This does not make use of the tools you mention (OpenSSH and Git Bash) but allows you to reach your goals (scp, Bash).
– simlev
Feb 27 '17 at 19:35
add a comment |
My warm recommendation is to use Cygwin to accept ssh connections on your Windows machine. This would allow you to scp to and from it, as well as login from a remote system via ssh to a Bash shell and command-line git.
user@linuxhost$ ssh 192.168.x.x
Last login: Sun Feb 12 08:20:07 2017 from 10.x.x.x
user@windowshost$ echo $0 && git --version
-bash
git version 2.8.3
The shell can of course be customized: ash, bash, dash and sh are included by default, but just run the Cygwin installer and you can add your choice of zsh, mksh, tcsh or posh. Then add the following line to /etc/nsswitch.conf
:
db_shell: /bin/sh
possibly substituting /usr/bin/sh
with the path to your preferred shell. All Cygwin processes (terminal windows and sshd service) must be restarted for the setting to take effect.
There is even a way to get a cmd or powershell prompt upon login, which I recently found out about on Stackoverflow.
- Download winpty for Cygwin and extract
winpty.exe
,winpty.dll
andwinpty-agent.exe
to/bin
. If you do this from outside of a Cygwin terminal, look for abin
subdirectory of the Cygwin installation folder.
Create two batch files in
/bin
and make sure they have execute permissions. Let's name them winpty-cmd.bat and winpty-powershell.bat and fill them with the following contents, where of course<cygwin path>
is a placeholder for the path you installed Cygwin to (by default it'sC:cygwin
):
@ECHO OFF
<cygwin path>binwinpty.exe cmd
and
@ECHO OFF
<cygwin path>binwinpty.exe powershell
Put one of these lines into
/etc/nsswitch.conf
:
db_shell: /bin/winpty-cmd.bat
or
db_shell: /bin/winpty-powershell.bat
- Restart the sshd service.
Since the title has been "reworded" and my post might now seem sligthly out of place, allow me to directly answer the original question:
"Use git bash instead of cmd when sshing from Linux"
In addition to using Cygwin to accept ssh connections on the Windows machine:
- Follow step
1.
above.
Create a file called
<cygwin path>binwinpty-gitbash.bat
with these contents, where<cygwin path>
is a placeholder for the path you installed git-for-windows to (by default it'sC:Program FilesGit
):
@ECHO OFF
SET PATH="/bin"
<cygwin path>binwinpty.exe "<git path>binbash.exe"
Put this line into
/etc/nsswitch.conf
:
db_shell: /bin/winpty-gitbash.bat
- Restart the sshd service.
Update - September 2018:
Things change, and Win32-OpenSSH now allows choosing the default shell (any shell actually) by setting its path in a registry key. See Brethlosze's recent answer.
This does not make use of the tools you mention (OpenSSH and Git Bash) but allows you to reach your goals (scp, Bash).
– simlev
Feb 27 '17 at 19:35
add a comment |
My warm recommendation is to use Cygwin to accept ssh connections on your Windows machine. This would allow you to scp to and from it, as well as login from a remote system via ssh to a Bash shell and command-line git.
user@linuxhost$ ssh 192.168.x.x
Last login: Sun Feb 12 08:20:07 2017 from 10.x.x.x
user@windowshost$ echo $0 && git --version
-bash
git version 2.8.3
The shell can of course be customized: ash, bash, dash and sh are included by default, but just run the Cygwin installer and you can add your choice of zsh, mksh, tcsh or posh. Then add the following line to /etc/nsswitch.conf
:
db_shell: /bin/sh
possibly substituting /usr/bin/sh
with the path to your preferred shell. All Cygwin processes (terminal windows and sshd service) must be restarted for the setting to take effect.
There is even a way to get a cmd or powershell prompt upon login, which I recently found out about on Stackoverflow.
- Download winpty for Cygwin and extract
winpty.exe
,winpty.dll
andwinpty-agent.exe
to/bin
. If you do this from outside of a Cygwin terminal, look for abin
subdirectory of the Cygwin installation folder.
Create two batch files in
/bin
and make sure they have execute permissions. Let's name them winpty-cmd.bat and winpty-powershell.bat and fill them with the following contents, where of course<cygwin path>
is a placeholder for the path you installed Cygwin to (by default it'sC:cygwin
):
@ECHO OFF
<cygwin path>binwinpty.exe cmd
and
@ECHO OFF
<cygwin path>binwinpty.exe powershell
Put one of these lines into
/etc/nsswitch.conf
:
db_shell: /bin/winpty-cmd.bat
or
db_shell: /bin/winpty-powershell.bat
- Restart the sshd service.
Since the title has been "reworded" and my post might now seem sligthly out of place, allow me to directly answer the original question:
"Use git bash instead of cmd when sshing from Linux"
In addition to using Cygwin to accept ssh connections on the Windows machine:
- Follow step
1.
above.
Create a file called
<cygwin path>binwinpty-gitbash.bat
with these contents, where<cygwin path>
is a placeholder for the path you installed git-for-windows to (by default it'sC:Program FilesGit
):
@ECHO OFF
SET PATH="/bin"
<cygwin path>binwinpty.exe "<git path>binbash.exe"
Put this line into
/etc/nsswitch.conf
:
db_shell: /bin/winpty-gitbash.bat
- Restart the sshd service.
Update - September 2018:
Things change, and Win32-OpenSSH now allows choosing the default shell (any shell actually) by setting its path in a registry key. See Brethlosze's recent answer.
My warm recommendation is to use Cygwin to accept ssh connections on your Windows machine. This would allow you to scp to and from it, as well as login from a remote system via ssh to a Bash shell and command-line git.
user@linuxhost$ ssh 192.168.x.x
Last login: Sun Feb 12 08:20:07 2017 from 10.x.x.x
user@windowshost$ echo $0 && git --version
-bash
git version 2.8.3
The shell can of course be customized: ash, bash, dash and sh are included by default, but just run the Cygwin installer and you can add your choice of zsh, mksh, tcsh or posh. Then add the following line to /etc/nsswitch.conf
:
db_shell: /bin/sh
possibly substituting /usr/bin/sh
with the path to your preferred shell. All Cygwin processes (terminal windows and sshd service) must be restarted for the setting to take effect.
There is even a way to get a cmd or powershell prompt upon login, which I recently found out about on Stackoverflow.
- Download winpty for Cygwin and extract
winpty.exe
,winpty.dll
andwinpty-agent.exe
to/bin
. If you do this from outside of a Cygwin terminal, look for abin
subdirectory of the Cygwin installation folder.
Create two batch files in
/bin
and make sure they have execute permissions. Let's name them winpty-cmd.bat and winpty-powershell.bat and fill them with the following contents, where of course<cygwin path>
is a placeholder for the path you installed Cygwin to (by default it'sC:cygwin
):
@ECHO OFF
<cygwin path>binwinpty.exe cmd
and
@ECHO OFF
<cygwin path>binwinpty.exe powershell
Put one of these lines into
/etc/nsswitch.conf
:
db_shell: /bin/winpty-cmd.bat
or
db_shell: /bin/winpty-powershell.bat
- Restart the sshd service.
Since the title has been "reworded" and my post might now seem sligthly out of place, allow me to directly answer the original question:
"Use git bash instead of cmd when sshing from Linux"
In addition to using Cygwin to accept ssh connections on the Windows machine:
- Follow step
1.
above.
Create a file called
<cygwin path>binwinpty-gitbash.bat
with these contents, where<cygwin path>
is a placeholder for the path you installed git-for-windows to (by default it'sC:Program FilesGit
):
@ECHO OFF
SET PATH="/bin"
<cygwin path>binwinpty.exe "<git path>binbash.exe"
Put this line into
/etc/nsswitch.conf
:
db_shell: /bin/winpty-gitbash.bat
- Restart the sshd service.
Update - September 2018:
Things change, and Win32-OpenSSH now allows choosing the default shell (any shell actually) by setting its path in a registry key. See Brethlosze's recent answer.
edited Jan 23 at 18:12
answered Feb 27 '17 at 19:03
simlevsimlev
3,0263527
3,0263527
This does not make use of the tools you mention (OpenSSH and Git Bash) but allows you to reach your goals (scp, Bash).
– simlev
Feb 27 '17 at 19:35
add a comment |
This does not make use of the tools you mention (OpenSSH and Git Bash) but allows you to reach your goals (scp, Bash).
– simlev
Feb 27 '17 at 19:35
This does not make use of the tools you mention (OpenSSH and Git Bash) but allows you to reach your goals (scp, Bash).
– simlev
Feb 27 '17 at 19:35
This does not make use of the tools you mention (OpenSSH and Git Bash) but allows you to reach your goals (scp, Bash).
– simlev
Feb 27 '17 at 19:35
add a comment |
According to this you can configure the DefaultShell for OpenSSH in Windows, to be PowerShell or any other executable.
It requires to add the String Registry Key ComputerHKEY_LOCAL_MACHINESOFTWAREOpenSSHDefaultShell
with the path of the Shell Executable as string value, i.e.:
Powershell: C:WindowsSystem32WindowsPowerShellv1.0powershell.exe
CygWin Bash: C:Cygwin64binbash.exe
I tested it and works as expected.
From the Win32-OpenSSH wiki:
On the server side, configure the default ssh shell in the windows
registry.
ComputerHKEY_LOCAL_MACHINESOFTWAREOpenSSHDefaultShell
- full path of the shell executable
ComputerHKEY_LOCAL_MACHINESOFTWAREOpenSSHDefaultShellCommandOption
(optional) - switch that the configured default shell requires to
execute a command, immediately exit and return to the calling process.
By default this is-c
.
ComputerHKEY_LOCAL_MACHINESOFTWAREOpenSSHDefaultShellEscapeArguments
(optional) - flag that allow you to skip escaping the arguments of
default shell. By default this is0
. This option is only applicable to
shells other than powershell, powershell, bash, cygwin, cmd, and
ssh-shellhost.exe.
1
Thank you, I like this! The page you link to was first created on 13 Sep 2018, it was about time!
– simlev
Jan 23 at 17:57
add a comment |
According to this you can configure the DefaultShell for OpenSSH in Windows, to be PowerShell or any other executable.
It requires to add the String Registry Key ComputerHKEY_LOCAL_MACHINESOFTWAREOpenSSHDefaultShell
with the path of the Shell Executable as string value, i.e.:
Powershell: C:WindowsSystem32WindowsPowerShellv1.0powershell.exe
CygWin Bash: C:Cygwin64binbash.exe
I tested it and works as expected.
From the Win32-OpenSSH wiki:
On the server side, configure the default ssh shell in the windows
registry.
ComputerHKEY_LOCAL_MACHINESOFTWAREOpenSSHDefaultShell
- full path of the shell executable
ComputerHKEY_LOCAL_MACHINESOFTWAREOpenSSHDefaultShellCommandOption
(optional) - switch that the configured default shell requires to
execute a command, immediately exit and return to the calling process.
By default this is-c
.
ComputerHKEY_LOCAL_MACHINESOFTWAREOpenSSHDefaultShellEscapeArguments
(optional) - flag that allow you to skip escaping the arguments of
default shell. By default this is0
. This option is only applicable to
shells other than powershell, powershell, bash, cygwin, cmd, and
ssh-shellhost.exe.
1
Thank you, I like this! The page you link to was first created on 13 Sep 2018, it was about time!
– simlev
Jan 23 at 17:57
add a comment |
According to this you can configure the DefaultShell for OpenSSH in Windows, to be PowerShell or any other executable.
It requires to add the String Registry Key ComputerHKEY_LOCAL_MACHINESOFTWAREOpenSSHDefaultShell
with the path of the Shell Executable as string value, i.e.:
Powershell: C:WindowsSystem32WindowsPowerShellv1.0powershell.exe
CygWin Bash: C:Cygwin64binbash.exe
I tested it and works as expected.
From the Win32-OpenSSH wiki:
On the server side, configure the default ssh shell in the windows
registry.
ComputerHKEY_LOCAL_MACHINESOFTWAREOpenSSHDefaultShell
- full path of the shell executable
ComputerHKEY_LOCAL_MACHINESOFTWAREOpenSSHDefaultShellCommandOption
(optional) - switch that the configured default shell requires to
execute a command, immediately exit and return to the calling process.
By default this is-c
.
ComputerHKEY_LOCAL_MACHINESOFTWAREOpenSSHDefaultShellEscapeArguments
(optional) - flag that allow you to skip escaping the arguments of
default shell. By default this is0
. This option is only applicable to
shells other than powershell, powershell, bash, cygwin, cmd, and
ssh-shellhost.exe.
According to this you can configure the DefaultShell for OpenSSH in Windows, to be PowerShell or any other executable.
It requires to add the String Registry Key ComputerHKEY_LOCAL_MACHINESOFTWAREOpenSSHDefaultShell
with the path of the Shell Executable as string value, i.e.:
Powershell: C:WindowsSystem32WindowsPowerShellv1.0powershell.exe
CygWin Bash: C:Cygwin64binbash.exe
I tested it and works as expected.
From the Win32-OpenSSH wiki:
On the server side, configure the default ssh shell in the windows
registry.
ComputerHKEY_LOCAL_MACHINESOFTWAREOpenSSHDefaultShell
- full path of the shell executable
ComputerHKEY_LOCAL_MACHINESOFTWAREOpenSSHDefaultShellCommandOption
(optional) - switch that the configured default shell requires to
execute a command, immediately exit and return to the calling process.
By default this is-c
.
ComputerHKEY_LOCAL_MACHINESOFTWAREOpenSSHDefaultShellEscapeArguments
(optional) - flag that allow you to skip escaping the arguments of
default shell. By default this is0
. This option is only applicable to
shells other than powershell, powershell, bash, cygwin, cmd, and
ssh-shellhost.exe.
edited Jan 23 at 18:01
simlev
3,0263527
3,0263527
answered Dec 7 '18 at 1:08
BrethloszeBrethlosze
1279
1279
1
Thank you, I like this! The page you link to was first created on 13 Sep 2018, it was about time!
– simlev
Jan 23 at 17:57
add a comment |
1
Thank you, I like this! The page you link to was first created on 13 Sep 2018, it was about time!
– simlev
Jan 23 at 17:57
1
1
Thank you, I like this! The page you link to was first created on 13 Sep 2018, it was about time!
– simlev
Jan 23 at 17:57
Thank you, I like this! The page you link to was first created on 13 Sep 2018, it was about time!
– simlev
Jan 23 at 17:57
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1182522%2fconfigure-default-shell-initialized-by-openssh-on-windows-7%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You can do this easier with a dedicated tool. See for example if you like Gitblit.
– harrymc
Feb 27 '17 at 20:26