-
Download xshell6 from the netsarang official website (https://www.netsarang.com/zh/xshell/), you can use the non-commercial version, you need to provide your personal email address, and download it through the download link sent.
-
Install and start xshell6
-
Create a new session, set the name (such as virtual machine linux), the protocol is SSH, the host is set to the IP address of the virtual machine terminal (use the ip -a command to query the IP address on the Ubuntu terminal), and the port number is 22 by default
-
User authentication Enter the user name and password of the virtual machine terminal, and click Connect after completion.
-
Indicates that the connection failed, and troubleshoot the problem.
-
Enter sudo su in the virtual machine terminal to switch the user to root, and then follow the system prompts to enter the password (sudo means to execute as a root super administrator)
-
Execute sudo apt-get install vim (newly installed Ubuntu needs to install vim), the system will install according to the instructions
-
Execute sudo apt-get install openssh-server to install ssh service (remote connection is mainly used for this function), and the system will install according to the instructions
-
Execute netstat -ntlp|grep 22 to check whether port 22 is enabled, and the system prompts Command 'netstat' not found, but can be installed with:
-
Execute apt install net-tools to install the net-tools network configuration tool
-
Execute netstat -ntlp|grep 22 again successfully, port 22 has been opened
-
Execute sudo apt-get install ufw to install and configure the Ubuntu firewall (apt-get is a package management tool for Ubuntu)
-
Execute sudo ufw enable to enable the Ubuntu firewall
-
Execute sudo ufw allow 22 to allow external IP addresses to access port 22 of the machine
-
Try to connect to the xshell session again, and the connection is successful
The above is a bit of personal experience sharing. If there is something wrong, please criticize and correct me~