Article Directory
Required environment
Step 1: Install ssh server on Ubuntu
xshell
The remote connection ubuntu
is through the ssh protocol, so you need to ubuntu
install the ssh server
sudo apt-get install openssh-server
Check if the ssh service is started ps -e |grep ssh
If it is started, the process in the figure below will be displayed
If you don't need to start the ssh service, enter service ssh start
Or just restart the ssh service
sudo service ssh restart
Command to modify SSH configuration file
vi /etc/ssh/ssh_config
Step 2: Install Xshell on Windows
Xshell can be downloaded directly from the official website:
https://www.xshellcn.com/
The third step: mutual ping (because the ssh remote connection is connected through the network, if the network is not connected, it will not be able to connect.)
The virtual machine and the physical machine need to be able to ping each other. If there is no way to ping each other, then there is no way to connect remotely. It feels like the following two points:
- The virtual machine Ubuntu needs to be networked: you can refer to my blog, Ubuntu configuration static ip networking summary
- Pay attention to the firewall between the two, remember to open port 22 of the virtual machine (the default port number of the SSH server)
Actual operation
Ubuntu
After finishing the upper environment
Windows (the first login method to create a new session)
Create a new session,
As long as the required environment is complete , then the host will fill in the ip of the virtual machine Ubuntu. Do not change the default port number. Use SSH for the protocol. This screen will appear for the rest.
Fill in the password, and then log in.
Windows (second login method)
Command line mode:
ssh 用户名@ip
Then there will be a pop-up that needs to enter the password corresponding to the user name.
note
Under the Ubuntu operating system, you must remember to install the ssh server , otherwise this error is always reported in the figure below.
note
When typing a command in xshell, if you type the wrong letter, you want to delete the wrong letter by pressing the backspace key, but it is displayed on the screen “^H”
, and the backspace does not work. Press the delete key again, but it shows “^[[3~”
that it can’t be deleted. The wrong letter.
The first way
Modification method: File -> Open -> Properties -> Terminal -> Keyboard, change the delete and backspace sequence to ASCII 127.
The second way
Because the Shell used here is dash, the operation is not as convenient as the bash in Ubuntu. You only need to change the user login shell:
The Shell used for login is the terminal command used after the login command. Ubuntu defaults to bash
As follows, this is the biaobiao
user dash
interface,
Change to bash
after
sudo usermod -s /bin/bash biaobiao
Then after reconnecting:
Becomes exactly the same as Ubuntu, and the operation is very convenient