CentOS 7.4 安装SSH 步骤

kant
kant
管理员
302
文章
0
粉丝
经验评论736阅读模式

网上教程太多,导致坑也特多,自己基本踩完了,这里记录。

1、查看是否安装了相关软件:
rpm -qa|grep -E "openssh"文章源自:毕卡奥,阅读原文请搜索毕卡奥!毕卡奥-https://www.bikaao.com/archives/581.html

显示结果含有以下三个软件,则表示已经安装,否则需要安装缺失的软件
openssh-ldap-6.6.1p1-35.el7_3.x86_64
openssh-clients-6.6.1p1-35.el7_3.x86_64
openssh-6.6.1p1-35.el7_3.x86_64
openssh-askpass-6.6.1p1-35.el7_3.x86_64
openssh-server-6.6.1p1-35.el7_3.x86_64
openssh-keycat-6.6.1p1-35.el7_3.x86_64
openssh-server-sysvinit-6.6.1p1-35.el7_3.x86_64文章源自:毕卡奥,阅读原文请搜索毕卡奥!毕卡奥-https://www.bikaao.com/archives/581.html

2、安装缺失的软件:
yum install openssh*文章源自:毕卡奥,阅读原文请搜索毕卡奥!毕卡奥-https://www.bikaao.com/archives/581.html

3、注册使用服务:
systemctl enable sshd
systemctl start sshd( 或者service sshd start )文章源自:毕卡奥,阅读原文请搜索毕卡奥!毕卡奥-https://www.bikaao.com/archives/581.html

4、使用非常规的SSH 端口
SSH预设使用端口(port) 22,修改成不常见端口
编辑 /etc/ssh/sshd_config 文件,查找 # Port 22 改为 Port 10873
重启服务:systemctl restart sshd.service
注意:需在1024 – 65535之间的数字文章源自:毕卡奥,阅读原文请搜索毕卡奥!毕卡奥-https://www.bikaao.com/archives/581.html

5、开启防火墙的SSH端口,如果SSH定义的端口不是22这里也需修改:
sudo firewall-cmd --zone=public --add-port=22/tcp --permanentsudo service firewalld restart

6、配置SSH登录密码与密钥身份验证
编辑/etc/ssh/sshd_config文件,查找
PasswordAuthentication no
改为
PasswordAuthentication yes

7、关闭SELinux,不关闭很多未知问题,很多坑在这
vi /etc/selinux/config
将SELINUX=enforcing改为SELINUX=disabled
设置后需要重启才能生效

文章末尾固定信息

历年同日文章
7 月
30
 
kant
  • 本文由 kant 发表于2019年7月30日 14:25:35
  • 转载请务必保留本文链接:https://www.bikaao.com/archives/581.html
匿名

发表评论

匿名网友
确定

拖动滑块以完成验证