1. To enable the ssh service, you first need to install the library that opens the ssh service:
sudo apt-get install openssh-server
2. Check the current ssh opening status:
ps -e |grep ssh
3. If there is sshd, the ssh-server has been started; if there is only agent, it has not been started;
start the ssh service:
/etc/init.d/ssh start or systemctl restart sshd
4. If you want to start the ssh service automatically after booting
sudo systemctl enable sshd
Similarly, the shutdown service command is:
sudo systemctl disable ssh
Open service once
sudo systemctl start ssh
Single shutdown service
sudo systemctl stop ssh
For the self-starting command, you can reboot after entering it. Use the sudo systemctl status sshd command to check whether ssh is started. If you see Active: active (running), it means success
If you simply enable the ssh service, then ps to view ssh, then /etc/init.d/ssh start or systemctl restart sshd
When connecting to xshell, I have been unable to connect, and it does not work after restarting. At this time, ifconfig checks whether the network card of the virtual machine has changed, because the ip is not static