How to uninstall, install, and start SSH services completely

Source: Internet
Author: User
Tags ssh account

SSH localhost by command

To see if the SSH service is already installed

The SSH service is already installed, as shown in the following illustration


If a situation like the following appears, the SSH service is not installed on this machine

SSH localhost

Ssh:connect to host localhost Port 22:connection refused

First, let's talk about how to uninstall the SSH service. 1. Completely uninstall SSH service

Apt-get Purge Openssh-server

2, update the source list (you can install the latest SSH service)

sudo apt-get update

3. Install SSH Service

sudo apt-get install Openssh-server

Enter the following command system to automatically install the SSH service.

4, the first step after installing SSH service is to open SSH service sudo/etc/init.d/ssh start

Sudo/etc/init.d/ssh start
5, after the start, you can use the following command to see if the service starts correctly

Ps-e|grep SSH

6212? 00:00:00 sshd

6, after the completion of the boot can modify the SSH configuration
Gedit/etc/ssh/sshd_config

7, Next is part of the error and resolution

PS1: The first time the connection needs to enter the password, then no longer need to enter the password. Less to enter the SSH account password, is not more secure.

PS2: again restrict IP access SSH, the server will be more secure.
Vi/etc/hosts.allow

Sshd:172.16.x.x:allow #在最后一行写入172.16.x.x/172.16.0 (paragraph)
Vi/etc/hosts.deny

Sshd:all

PS3: Suppose you want to delete the public key, do not select the public key when connecting SECURECRT, and then enter the SSH configuration file to modify the following:

1. Annotation #authorizedkeysfile%h/.ssh/authorized_keys

2, Passwordauthentication Yes

PS4: Prompt when using SECURECRT connection: Unable to authenticate using any of the configured authentication methods

Resolved: Passwordauthentication Yes

Please correct me if there is a mistake.

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.