Remotely connect to the Ubuntu system through SSH

SSH remote connection to Ubuntu system outside [no public network IP]

foreword

With the development of technology and economy, there are more and more electronic devices around us, and different electronic devices also allow us to come into contact with operating systems with their own characteristics. However, how to effectively perform data interconnection and remote operation among various operating systems has become more troublesome. Now, we can connect different operating systems through the data tunnel established by cpolar . Now, let's take a look at how to remotely connect Windows and Ubuntu systems .

1. Install cpolar software under Ubuntu system

First, we need to install the cpolar software under the Ubuntu system. However, some Ubuntu systems do not come with curl software, so you need to install curl first, and you can enter the command

sudo apt install curl

Install the curl software, then we enter the command to install the cpolar software

curl -L https://www.cpolar.com/static/downloads/install-release-cpolar.sh | sudo bash

Add a service to the system

sudo systemctl enable cpolar

Start the cpolar service

sudo systemctl start cpolar

img

img

img

img

2. After the installation is complete, open the cpolar client web-UI interface

After completing the cpolar installation program, we can enter localhost:9200 in the browser address bar of the Ubuntu system to open the Web-UI interface of the cpolar client. And log in to the cpolar client.

img

img

3. Create a tunnel to obtain the public network address of the Ubuntu system

Then we click "Create Tunnel" under "Tunnel Management" on the left side of the cpolar main interface, and make necessary settings for this data tunnel. The tunnel name is set to ssh, the protocol is set to tcp, the local address is set to port 22, and the port type is temporarily set to random temporary tcp port. After the setting is complete, you can click the "Create" button below to obtain the public network address connected to the Ubuntu system.

img

4. Open the Windows command interface and enter the command

After obtaining the public network address of Ubuntu, we can open the command line interface of Windows. and enter the command

ssh -p XXXXX 用户名@1.tcp.vip.cpolar.cn(X为cpolar生成的端口号,用户名替换为主机用户名)

There are two points to note here. One is to add "(space)-p (space)" before the digital port number, otherwise the tunnel cannot be connected; the other is to add "ssh ubuntu username@" after Enter the tcp address generated by the copy client . After entering the correct command, the system will display a prompt message asking whether you are sure to connect to the port, and ask to enter the password of the Ubuntu system. At this time, enter "yes" and the password of the ubunt system respectively.

img

As long as the system shows the green characters shown in the figure above, and the displayed content is the name of the Ubuntu system (and followed by @Ubuntu), it proves that the SSH connection to Ubuntu in the Windows system has been successful, and we can operate the Ubuntu system by entering commands. Of course, the function of cpolar is not limited to remote connection to other systems, and the data tunnel created by cpolar can also be applied in more scenarios. If you have any questions about the use of cpolar, please contact us, we will provide you with assistance within our ability. Of course, you are also welcome to join the VIP official group of cpolar to explore the unlimited potential of cpolar together.

Reprinted from cpolar pole cloud article: [SSH remote connection to Ubuntu system [no public network IP]] ( SSH remote connection to Ubuntu system [no public network IP] - cpolar pole cloud )

Guess you like

Origin blog.csdn.net/ks_wyf/article/details/132164178