Under VMware WorkStation, I installed Ubuntu, and then used XManager's XShell to connect to my Ubuntu on the Windows desktop, but at the same time it prompted the connection failure.
Then I used the Windows CMD command prompt to ping the Ubuntu IP, and the connection was normal. Why can't I connect with XShell? So I guessed that Ubuntu did not enable SSH service by default.
SSH is divided into client openssh-client and server openssh-server.
If you just want to log in to the SSH of another machine, you only need to install openssh-client (Ubutntu has a default installation, if not, sudo apt-get install openssh-client), if you want to open the SSH service on this machine, you need to install openssh-server.
Here I use the command sudo apt-get install openssh-server to install the server SSH.
Then use the command to confirm whether sshserver is started: ps -e |grep ssh
If you see sshd, then ssh-server has been started.
If not, you can start it like this: sudo /etc/init.d/ssh start
The ssh-server configuration file is located in /etc/ssh/sshd_config, where you can define the SSH service port, the default port is 22.
Then restart the SSH service:
sudo /etc/init.d/ssh stop
sudo /etc/init.d/ssh start
Set the ssh service to start automatically after booting:
Configure openssh-server to automatically start at boot in Ubuntu
Open the /etc/rc.local file and add the following statement:
/etc/init.d/ssh start
Recommended Posts