The solution to SSH remote login cannot be used in Ubuntu; installation and configuration of SSH service

Source: Internet
Author: User

In the process of learning to use the Ubuntu system, we often encounter the inability to remotely use the SSH protocol to log in, or can not use root login problem, in fact, Ubuntu default does not install SSH service, according to view some of the great God's information plus their summary, a little experience, Share to everyone, hope to help you solve the problem.


Regardless of the above situation, first of all to see whether the SSH package is not installed or SSH service is not turned on, the specific view method is as follows: (The following operations are under the root authority)

Execution:ssh localhost

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/9B/56/wKiom1lh68LBIJCwAAAcDMLZD70616.png "title=" 1.PNG "alt=" Wkiom1lh68lbijcwaaacdmlzd70616.png "/>

As shown, if the connection refused is not installed SSH service, this time need to be in the network state (because to download the package on the network)

Execute:sudo apt-get install openssh-server

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/9B/56/wKioL1lh7JvxG2OsAABHHS14HHQ812.png "title=" 2.PNG "alt=" Wkiol1lh7jvxg2osaabhhs14hhq812.png "/>

As shown, wait for completion. Once completed, you will need to restart the SSH service.

Execution:sudo/etc/init.d/ssh start

650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/9B/56/wKiom1lh7RLhcRqKAAAkMlH-h40340.png "title=" 3.PNG "alt=" Wkiom1lh7rlhcrqkaaakmlh-h40340.png "/>

Displaying OK indicates that the restart was successful.

Execute:ps-e|grep ssh view SSH service is open

650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M01/9B/56/wKiom1lh7iWCxb1HAAAZ1r_GAKc059.png "title=" 4.PNG "alt=" Wkiom1lh7iwcxb1haaaz1r_gakc059.png "/>

Next you need a configuration file that needs to be changed

Execution:nano/etc/ssh/sshd_config

650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/9B/57/wKioL1lh7o-QWo-pAAAVj6pAhL8266.png "title=" 5.PNG "alt=" Wkiol1lh7o-qwo-paaavj6pahl8266.png "/>

Go to an edit page (the Nano is an editing tool in the Linux system) and add the permitrootlogin Prohibit-password in front of it with #(sign Out), plus a Permitrootlogin Yes press Ctrl+o Save, will appear save the file name, do not change, the default line, direct enter, save after ctrl+x exit.

650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/9B/57/wKiom1lh7wbQu5wcAAAl3hwwux8870.png "title=" 6.PNG "alt=" Wkiom1lh7wbqu5wcaaal3hwwux8870.png "/>

Restart SSH service after exiting:sudo/etc/init.d/ssh start

Log in again using the remote SSH protocol, and root can also be logged in.









This article is from the Linux OPS blog, so be sure to keep this source http://jk6627.blog.51cto.com/12002684/1945686

The solution to SSH remote login cannot be used in Ubuntu; installation and configuration of SSH service

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.