Cannot connect to remote host in pycharm - ssh

I just can't connect to remote interpreter in Pycharm professional on my Mac. But I've connected to my interpreter very well in the past few weeks.
It is always showing "Connecting to XXX(my host ip)". I configured it with SSH Credentials and Deployment configuration. And I tested the sftp, it worked fine.
However, I can use my terminal to connect to my host successfully via ssh.
I just don't understand what happens.

I tried many ways and finally found that it was because I changed the default bash to zsh on my server. After changing zsh back to bash, it was fixed.

Related

Does replit uses ssh?

Replit's terminal provides a lot of features that are very similar to any Linux terminal. At first, I thought the site was using SSH to link a remote terminal to the website but when I ran the following command service ssh status, then the output was
* sshd is not running. This indicates that the site is not using SSH to link the terminal.
Does this mean the developers have created a custom terminal for their website or is there a way to show this output for remote users for security purposes?

SSH'ing from windows 10 into wsl2 ubuntu

I am fairly new to this business and I fail to understand how to SSH from my win10 machine into my installed wsl2 ubuntu 20.4
Basically, I followed this tutorial, But I keep getting the following errors:
when I try to SSH using the public port (using curl ifconfig.me) gives me the error "connection timed out"
when I try to SSH using the private port (using ip route get 1.2.3.4 | awk '{print $7}') it gives me the error "Permission denied"
at some point I got the error "sshd: no hostkeys available -- exiting" so I followed this fix but then I got the errors mentioned before. Should I delete any from the /etc/ssh folder?
The end-goal is ssh'ing through vs-code, but I guess once I could do it from powershell, it's the same from vs-code.
It appears that you need to enter /etc/ssh/sshd_config (with sudo permissions) and change the following lines:
ChallengeResponseAuthentication yes
PasswordAuthentication yes
Since you seem to have fixed your issue with ssh, let me propose that your ultimate goal ("ssh into WSL from VSCode) might be better accomplished using Microsoft's "Remote Development" extension pack, which includes several extensions. While it sounds like you are considering using the "Remote - SSH" extension, you can also use the "Remote - WSL" extension directly.
After installing either the extension pack or the WSL extension directly, just open your WSL instance, cd to the directory with your code and then code . (including the period). This will open VSCode and install a shim into the WSL instance which will allow communication between the two.
See the docs from Microsoft for more detail.
Also, on the topic of your original question, you said that you edited sshd_config to permit password authentication (I don't think the ChallengeResponseAuthentication change was necessary). That's one way to go, but ultimately I'd recommend generating an SSH key pair, copying the private key to something like C:\Users\yourid\.ssh\id_rsa and using that instead of a password login.
And you mentioned in your original question that you were unable to access SSH on the public port. This is because WSL2 does not do NAT, so it also won't be accessible from a second computer without (a lot of) additional effort (manual port-forwarding from Windows to WSL, which will have to be reset on reboot since the WSL interface address will change).
As you've discovered, the WSL interface address will work, but remember that it will change on each reboot of Windows (technically, I think, any time the WSL subsystem is shut down and restarted). IMHO, you're better off using 127.0.0.1 or localhost.
But really, my preferred method of accessing WSL remotely is to install OpenSSH on Windows 10, port 22. Then you can simply do something like ssh -t windowsusername#mycomputername.local wsl to get access to the WSL instance. You can even do this when you have multiple WSL instances on your machine with ssh -t windowsusername#mycomputername.local wsl -d WSLInstanceName.
If you use this technique, of course, and you still want to run an SSH server in a WSL instance, you'll need to use a different port. But I really think you should do this anyways when running SSH under WSL. Otherwise, you are likely to spin up a second WSL instance at some point and run into port conflicts anyway.
The downside is that the Windows OpenSSH -> WSL hack won't allow you to run things like VSCode through SSH, but it does provide super-simple access to WSL through SSH, and works remotely (if you ever need that) as well.

Pycharm Remote Dev using SFTP with Yubi Key authentication

I have PyCharm Pro. I am trying to do remote development on a server. I have read the following Jetbrains tutorials:
Deploying Applications
Remote Development on Raspberry Pi
as well as the very helpful tutorial:
Remote debugging with pycharm the missing tutorial
While I seem to be able to set everything up, authentication fails when I try to connect to the remote server using the 'SFTP' protocol. I can make an SSH and SFTP connection from the CLI in a terminal so I know the ssh configuration settings are correct. However, in my case authentication requires ssh and having a Yubi key connected to my laptop. Does that make a difference?
Has anyone had a similar issue? If so, how did you resolve it?
On MacOS the challenge is where the IDE is getting it's ssh socket agent. To make this work in my case I have to launch the PyCharm Pro IDE from a terminal.
Go to '/Applications/PyCharm.app/Contents/MacOS' directory and launch with './pycharm'

Pycharm cannot finish updating skeletons

I'm newly moving from a Linux working environment to Windows, and I'm mainly using local port forwarding+Pycharm to run my python code on a server that is double-hop from my laptop.
I am able to establish the ssh tunnel through Windows cmd or MobaXterm local terminal or MobaXterm tunneling tool. I works fine on my Pycharm, when I check it from tools/deployment/configuration/test connection, and I can also see the files in remote server. But every time I start my Pycharm, it shows two background process, "updating python interpreter" and "updating pycharm helper", and the precess bar simply do not show any moving on! And I cannot run python on remote server, because Pycharm says I lack python helper.
And most wired, when it is running these two precess, my terminal for local port forwarding freezes, and I cannot type in commands in the jump server. And when I try to recheck the connection, it turns out that connection fails.
My ssh tunneling+pycharm deployment used to work fine in my Ubuntu. Thanks anybody who can shed light on my confusion!
Well, thanks everyone, I have solved this problem.
The reason is simple, but I did not notice that the ~/.pycharm_helper 's size is actually changing in the process, while the GUI bar may be not moving.
So it is due to my double-hop inconvenience, and the low Internet speed. I left it in dorm for a whole night out, and it comes out just fine.

Get remote cmd from linux termnal

I need to run some scripts in a windows remote machine from a terminal linux, I've tried using telnet however in the windows machine it's unable and there isn't installed a ssh server. So I need other way to run the command remotely without a graphical interface.
I have the possibility for run the command from a windows machine, however I need to open a SSH Tunnel to see the remote machine, I've used psexec but it didn't work for me.
Do you have access to install software on the remote server?
Your SSH client will not be able to connect to the remote machine unless that machine is running an SSH server to respond to your client's connection request.
There are a number of possible options for SSH servers to run on Windows.
(Google for ssh server windows)
Because SSH gives an external user some access to/control over your server it is designed to be a secure tool. I would therefore recommend using an SSH server which is still actively maintained, and keep it up to date. Servers which are old and no longer supported are are likely to contain known security issues which may never be addressed, thereby leaving your server vulnerable.
There are a number of good free open-source solutions for this, so you shouldn't need to buy anything.
In the past I've worked with Windows machines running Cygwin, with the OpenSSH ssh server installed. Depending how much of the Cygwin system you choose to install, it can make the target Windows host rather like logging into another Linux box in terms of environment.
You can download the installer for Cygwin from http://www.cygwin.com/