Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to use ssh to connect to remote computer in ubuntu

Shulou Source: shulou.com Published: 2022-06-01 14:50:22 11月06日 Update

Ubuntu how to use ssh to connect to remote computers, I believe that many inexperienced people do not know what to do, so this paper summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.

The installation of ssh client and server is very simple. After opening the terminal, you only need two commands:

The code is as follows:

Sudo apt-get install openssh-client # # this is to install the client

Sudo apt-get install openssh-server # # this is the installation server

The service is enabled automatically after the default installation is completed, which can be viewed through ps-e | grep ssh. If ssh-agent appears, the service is enabled successfully. So how do you shut down the server if you don't want someone else to log on to your computer? It's simple, just enter

The code is as follows:

Sudo service ssh stop

It's done, it's simple: -) what about opening it again? Smart you must have thought that as long as you type

The code is as follows:

Sudo service ssh start

The service will be turned on again, convenient! (* ^ _ ^ *) hee hee.

OK, after installing the client and server of ssh, let's log in to our own computer.

At the terminal, enter:

The code is as follows:

Ssh usr@hostname

Usr is a user name, and hostname is the name of your host, for example, my host name is ubuntu, because my linux distribution is ubuntu. If I want to log in to ubuntu with the user flyingrain, I can enter it like this:

The code is as follows:

Ssh flyingrain@ubuntu

It is convenient to log in as long as you enter the user's password again.

OK, let's try logging in to the remote computer now. To log in to a remote computer, you need a server equipped with ssh. Suppose my friend's computer has been installed with the ssh server, so I can do this to log in to his computer:

The code is as follows:

Ssh usr@ip

Similarly, usr refers to a user of the computer, and ip refers to the ip address of the computer (so it is best to use a static ip on a connected remote computer). After executing this command, you will be asked to enter your password, just enter the password of usr. If this is the first time to connect, Server will ask you, your online Key has not been established, do you want to accept the Key from Server and establish an online connection? He he! At this time, please "be sure to enter yes instead of y or Y", so that the program will accept it!

After reading the above, have you mastered how to use ssh to connect to a remote computer in ubuntu? 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!

Tags: Computer service input code user host client password content name command method more terminal this is problem login hee hee smart Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Microsoft MySQL OPPO Reno vpn