How to connect to a remote computer through ssh in ubuntu

Source: Internet
Author: User
Tags ssh server
This article describes how to connect to a remote computer through ssh in ubuntu. For more information, see Ubuntu.

Currently, most linux distributions have ssh clients installed in advance, that is, they can connect to other computers. But there are exceptions, so let's talk about the installation of the ssh client and the server first.

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

Copy codeThe code is as follows:
Sudo apt-get install openssh-client # This is the installation client
Sudo apt-get install openssh-server # install the server

The service is automatically enabled after the default installation is complete. you can view the service through ps-e | grep ssh. if ssh-agent is displayed, the service is successfully enabled. If you don't want others to log on to your computer, how can you shut down the server? It's easy, just enter

Copy codeThe code is as follows:
Sudo service ssh stop

Let's get it done. let's make it simple:-) what about enabling it again? Smart, you must have thought that you only need to input

Copy codeThe code is as follows:
Sudo service ssh start

Turn on the service again! (* ^__ ^ *) Xi ......

After installing the ssh client and server, log on to your computer.

Enter at the terminal:

Copy codeThe code is as follows:
Ssh usr @ hostname

Usr is a user name, hostname is the name of your host, like my host name is ubuntu, because my linux release is ubuntu, if I use the flyingrain user to log on to the ubuntu host, the following error occurs:

Copy codeThe code is as follows:
Ssh flyingrain @ ubuntu

You only need to enter the password of this user to log on. is it very convenient?

Now, let's try logging on to a remote computer. To log on to a remote computer, you must install the ssh server on the other side. Assume that my friend's computer has installed the ssh server, so I can log on to his computer in this way:

Copy codeThe 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 address to connect to a remote computer ). After executing this command, you will be asked to enter the password, as long as you enter the usr password. If this is the first connection, the Server will ask you if your online Key has not been created. do you want to accept the Key sent from the Server and establish the connection? Haha! In this case, please enter yes instead of y or Y, so that the program will accept it!

After the connection, you can remotely control the host. The operation is almost the same as operating your computer.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.