CreateProcessW failed error:2 ssh_askpass: posix_spawn: No such file or directory Host key verification failed, jupyter notebook on remote server
Question:
So I was following a tutorial to connect to my jupyter notebook which is running on my remote server so that I can access it on my local windows machine.
These were the steps that I followed.
On my remote server :
jupyter notebook --no-browser --port=8889
Then on my local machine
ssh -N -f -L localhost:8888:localhost:8889 *******@**********.de.gyan.com
But I am getting an error
CreateProcessW failed error:2
ssh_askpass: posix_spawn: No such file or directory
Host key verification failed.
How do I resolve this? Or is there is any other way to achieve the same?
Answers:
According to the openssh docs, the ssh client, which will usually prompt for a password on the command line, will try to show a GUI dialog for the user to enter his password, if SSH_ASKPASS
and DISPLAY
environment variables are set.
On windows however, this is not properly supported yet, as the needed ssh_askpass
binary is missing, and also because this seems still pretty X11 oriented.
Git for windows however seemed to get it working properly.
Of course, if you are just interested in entering your password on the command line, make sure the variables are unset. With the information you provided, it is however impossible to answer why the variable was set in the first place.
If you need the DISPLAY variable set because you want to use VcXsrc or another X-Server in Windows 10 the workaround is to add the host you want to connect to your known_hosts file.
This can be done by calling
ssh-keyscan -t rsa host.example.com | Out-File ~/.ssh/known_hosts -Append -Encoding ASCII;
You can show the values of "environment variables" with the POSIX shell command "env".
Or you simply type echo $DISPLAY
or echo $SSH_ASKPASS
. May vary from shell to shell.
Another way to solve the issue could be to insert your public RSA key into the .ssh/authorized_keys file on the target system, but this might only work if you enter this systems’s ID into your local known_hosts file first, as described above.
How to generate a RSA keypair: Use ssh-keygen -t rsa ...
.
Regards,
Stefan B.
I believe you have a ssh version <= 8.6.0-beta1. It will work by just updating to version 8.6.0-beta1+ in your elevated powershell by
choco upgrade openssh
You can check your version by
choco list -lo openssh # -lo: --localonly
openssh 8.6.0-beta1
This happened to me when using cygwin. There was an ssh.exe in the PATH c:windowssystem32ssh.exe ahead of /usr/bin/ssh. Fixing the PATH avoided the problem.
Edited /etc/profile and added a line like this near the end:
PATH=/usr/bin:${PATH}
I have the same probelm when I connect remote Linux server with local Windows10 VScode.
CreateProcessW failed error:2
ssh_askpass: posix_spawn: No such file or directory
Host key verification failed.
I solved this by upgrade OpenSSH to OpenSSH_for_Windows_8.9p1, LibreSSL 3.4.3.
- Download OpenSSH from https://github.com/PowerShell/Win32-OpenSSH/releases
- Decompress to somewhere
- Edit system environment variable ‘PATH’, and move it above old Openssh.
So I was following a tutorial to connect to my jupyter notebook which is running on my remote server so that I can access it on my local windows machine.
These were the steps that I followed.
On my remote server :
jupyter notebook --no-browser --port=8889
Then on my local machine
ssh -N -f -L localhost:8888:localhost:8889 *******@**********.de.gyan.com
But I am getting an error
CreateProcessW failed error:2
ssh_askpass: posix_spawn: No such file or directory
Host key verification failed.
How do I resolve this? Or is there is any other way to achieve the same?
According to the openssh docs, the ssh client, which will usually prompt for a password on the command line, will try to show a GUI dialog for the user to enter his password, if SSH_ASKPASS
and DISPLAY
environment variables are set.
On windows however, this is not properly supported yet, as the needed ssh_askpass
binary is missing, and also because this seems still pretty X11 oriented.
Git for windows however seemed to get it working properly.
Of course, if you are just interested in entering your password on the command line, make sure the variables are unset. With the information you provided, it is however impossible to answer why the variable was set in the first place.
If you need the DISPLAY variable set because you want to use VcXsrc or another X-Server in Windows 10 the workaround is to add the host you want to connect to your known_hosts file.
This can be done by calling
ssh-keyscan -t rsa host.example.com | Out-File ~/.ssh/known_hosts -Append -Encoding ASCII;
You can show the values of "environment variables" with the POSIX shell command "env".
Or you simply type echo $DISPLAY
or echo $SSH_ASKPASS
. May vary from shell to shell.
Another way to solve the issue could be to insert your public RSA key into the .ssh/authorized_keys file on the target system, but this might only work if you enter this systems’s ID into your local known_hosts file first, as described above.
How to generate a RSA keypair: Use ssh-keygen -t rsa ...
.
Regards,
Stefan B.
I believe you have a ssh version <= 8.6.0-beta1. It will work by just updating to version 8.6.0-beta1+ in your elevated powershell by
choco upgrade openssh
You can check your version by
choco list -lo openssh # -lo: --localonly
openssh 8.6.0-beta1
This happened to me when using cygwin. There was an ssh.exe in the PATH c:windowssystem32ssh.exe ahead of /usr/bin/ssh. Fixing the PATH avoided the problem.
Edited /etc/profile and added a line like this near the end:
PATH=/usr/bin:${PATH}
I have the same probelm when I connect remote Linux server with local Windows10 VScode.
CreateProcessW failed error:2
ssh_askpass: posix_spawn: No such file or directory
Host key verification failed.
I solved this by upgrade OpenSSH to OpenSSH_for_Windows_8.9p1, LibreSSL 3.4.3.
- Download OpenSSH from https://github.com/PowerShell/Win32-OpenSSH/releases
- Decompress to somewhere
- Edit system environment variable ‘PATH’, and move it above old Openssh.