Loading

使用ssh方式连接

``

查看和安装ssh:

    yum list installed | grep openssh-server#查看

    yum install openssh-server#安装

    


修改配置

1.vi etc/ssh/sshd_config

      1         $OpenBSD: sshd_config,v 1.100 2016/08/15 12:32:04 naddy Exp $

      2

      3 # This is the sshd server system-wide configuration file.  See

      4 # sshd_config(5) for more information.

      5

      6 # This sshd was compiled with PATH=/usr/local/bin:/usr/bin

      7

      8 # The strategy used for options in the default sshd_config shipped with

      9 # OpenSSH is to specify options with their default value where

     10 # possible, but leave them commented.  Uncommented options override the

     11 # default value.

     12

     13 # If you want to change the port on a SELinux system, you have to tell

     14 # SELinux about this change.

     15 # semanage port -a -t ssh_port_t -p tcp #PORTNUMBER

     16 #

     17 Port 22

     18 #AddressFamily any

     19 ListenAddress 0.0.0.0

     20 ListenAddress ::

     21

     22 HostKey /etc/ssh/ssh_host_rsa_key

     23 #HostKey /etc/ssh/ssh_host_dsa_key

     24 HostKey /etc/ssh/ssh_host_ecdsa_key

     25 HostKey /etc/ssh/ssh_host_ed25519_key

     26

     27 # Ciphers and keying

     28 #RekeyLimit default none

     29

     30 # Logging

     31 #SyslogFacility AUTH

     32 SyslogFacility AUTHPRIV

     33 #LogLevel INFO

     34

     35 # Authentication:

     36

     37 #LoginGraceTime 2m

     38 PermitRootLogin yes

     39 #StrictModes yes

     40 #MaxAuthTries 6

     41 #MaxSessions 10



找到17,19,20,38行。去掉#

接着开启sshd服务,检查服务是否开启

    service sshd start

    ps -e | grep sshd


开机自启


    systemctl enable sshd.service

posted @ 2021-12-22 23:04  夷某蓁  阅读(92)  评论(0)    收藏  举报