Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to remotely connect to Linux server in Ubuntu system

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

It is believed that many inexperienced people don't know what to do about how to connect to the Linux server remotely in the Ubuntu system. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

1.Windows connects to Ubuntu server

Install openssh-server

After installing xshell, you need to enable the SSH service under the connected Ubuntu host, because xshell uses ssh service to connect to Ubuntu. Of course, you can also configure password-free login Ubuntu, but that is a little more complicated. We only introduce login with account password.

Generally speaking, you need to install openssh-server before you can start the ssh service and run on the Ubuntu machine:

Sudo apt-get install openssh-server

Then open the ssh service:

Ps-e | grep ssh

It is generally recommended that the server be turned on 24 hours a day, so that you don't have to start ssh every time.

Xshell session

Open the xshell software, click New in the upper left corner, enter the connection name, the IP address of the Ubuntu machine, and note that the protocol selects ssh, and the port is 22.

Click the OK button, and then click the connect button, and then a window will pop up for you to enter your user name and password, and you can choose to remember the user name and password so that you don't have to type it again next time.

Then click the OK button and you can see that you are connected to the Ubuntu system.

Then everything you do to the server can be operated on this terminal. Now that you have chosen the Linux system, you should adapt to this pure command line operation, and you will be much more efficient after you are familiar with it.

File transfer

This is the most important part, since you want to run the data on the server, you have to send the data to the server.

There are many ways to transfer files. I have used filezilla to transfer files before, and then I found a simpler way to transfer files. You can use the upload / download toolkit rz and sz to upload and download files.

Install the toolkit first and enter it in the xshell command box:

Sudo apt-get install lrzsz

After installation, upload the file from Windows with the command rz, as shown in the figure:

The command to download a file from the server to Windows is sz, followed by the file name of the downloaded file:

Sz 2017-Tan Qingbo .doc

When this command is executed, it will let you choose the path where the file is saved, and then click the OK button.

Because it is a local area network, there should be no pressure to send large files in this way.

2.Ubuntu connects to Linux server

Before connecting, make sure that openssh-server is installed on the Linux server. See above for how to install it.

Modify the ssh configuration file on the Linux server, this file / etc/ssh/sshd_config, in which you change the value of PermitRootLogin to yes, and then restart the ssh service.

PermitRootLogin yes service sshd restart

Then you can log in to the server remotely from your Ubuntu machine. The way is as follows:

Ssh rootusername@IP

Rootusername is the user name of your server, and IP is the IP address of your server. After entering the password, you can log in. Ubuntu file transfer

Upload files

Scp file name rootusername@IP:/tmp

Due to the permission problem of the file system, the files of this system can only be uploaded to the / tmp folder of the server, and then copied from the tmp folder to the desired directory.

Download a file

If you copy files from a remote machine to the current directory on this machine, use this command:

Scp rootusername@IP:/home/a.tar.tz

Copy the files in the entire directory of the remote machine:

Scp-r rootusername@IP:/home/*. /

Note that the file transfer commands are run on the local terminal.

After reading the above, have you mastered how to remotely connect to the Linux server in the Ubuntu system? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report