日本免费高清视频-国产福利视频导航-黄色在线播放国产-天天操天天操天天操天天操|www.shdianci.com

學無先后,達者為師

網站首頁 編程語言 正文

如何在linux中安裝ssh服務

作者:沈信得 更新時間: 2023-10-18 編程語言

一、安裝

1.1、檢查ssh是否已經安裝

方式一

[root@localhost ~]# rpm -qa|grep ssh

方式二

[root@localhost ~]# ssh -version

1.2、使用yum進行安裝(必須可以連網)

  • 查看一下和ssh相關的安裝包
[root@localhost ~]# yum search ssh
  • 安裝openssh
[root@localhost ~]# yum install -y openssh-*

二、測試

2.1、配置ssh服務

  • 備份原始配置文件
[root@localhost ~]# cp /etc/ssh/sshd_config /etc/ssh/sshd_config.ori
  • 修改配置文件
[root@localhost ~]# vim /etc/ssh/sshd_config
  • 修改內容如下:
Port 52113

#Port 22

#AddressFamily any

#ListenAddress 0.0.0.0

#ListenAddress ::

#禁止root遠程登錄:

#LoginGraceTime 2m

PermitRootLogin no

#PermitRootLogin yes

#StrictModes yes

#MaxAuthTries 6

#MaxSessions 10

#禁止DNS:

UseDNS no

#UseDNS yes

#不允許密碼登錄:

PermitEmptyPasswords no

#PermitEmptyPasswords no
  • 檢查是否修改正確
[root@localhost ~]# vimdiff /etc/ssh/sshd_config.ori /etc/ssh/sshd_config

2.2、啟動SSH服務

  • 啟動
[root@localhost ~]# service sshd start
或者
[root@localhost ~]# /etc/init.d/sshd start
  • 有需要可以設置為開機啟動
[root@localhost ~]# chkconfig --level 35 sshd on
[root@localhost ~]# chkconfig --list sshd

原文鏈接:https://blog.csdn.net/shenxinde/article/details/124119911

  • 上一篇:沒有了
  • 下一篇:沒有了
欄目分類
最近更新