ssh本机失败(ssh: connect to host localhost port 22: Connection refused)

ssh本机失败(ssh: connect to host localhost port 22: Connection refused)

I. Description of the problem

  After previously been used on the service panel pagoda, today whim, you want to use the pagoda panel in the machine. (Pagoda panel really easy to use, especially for me zz white) ... but installed pagoda panel , terminal panel, I found input ssh username and password when there is no reaction, obviously is a password account, ah !!!

Some may ask, and you use tm pagoda panel on the machine, but also to use the terminal pagoda ,, it is not superfluous!? ,,, emmm really, but I just love superfluous ... since discovered this problem, try it how to solve it!

II. To solve the problem

  The reason may be: port is not open, the local firewall refused, the machine does not ssh service;

  Finally found the problem is that the machine does not ssh service, it is not for everyone to use linux when ssh is often used, but it may not be the native ssh services, so we want to install ssh service!;

  1. Generate ssh keys

    $ ssh-keygen -t rsa (连按回车,生成秘钥)
    
    $ cat ~/.ssh/id_rsa >> ~/.ssh/authorized_keys 
  2. Installation openssh-server (operating system as an example to ubuntu)

    $ sudo apt install openssh-server
     $ sudo /etc/init.d/ssh start 
  3. test

    $ ps -ef | grep ssh(查看sshd进程)
     $ ssh 127.0.0.1

Three Success:

  Figure:

Have questions, please leave a message ,,, see will help solve !!! 

Guess you like

Origin www.cnblogs.com/Cherrison-Time/p/11587816.html