[TOC]
(注:ssh7.4升级ssh8.1p,配置文件可以不用替换,值得注意的是:ssh7.4以下版本PermitRootLogin默认yes,
ssh8.1p版本PermitRootLogin默认是prohibit-password,即禁止root用密码登录)
#### 开启telnet
`yum install xinetd telnet-server -y`
```
systemctl enable xinetd
systemctl enable telnet.socket
```
```
systemctl start telnet.socket
systemctl start xinetd
```
`netstat -lntp|grep 23`
```
vi /etc/pam.d/remote
注释第一行
#auto required pam_securetty.so
```
`telnet ip`
telnet远程登录成功
#### 编译openssh-8.1p1
1.tar zxvf openssh-8.1p1.tar.gz
2.chown -R root.root /tmp/openssh-8.1p1
3.chattr -i /etc/ssh/sshd_config
4.rm -rf /etc/ssh/*
5.cd /tmp/openssh-8.1p1
6.yum install -y openssl-devel pam-devel zlib-devel
7.(./configure --prefix=/usr/ --sysconfdir=/etc/ssh --with-zlib --with-md5-passwords --with-pam && make && make install)
8.sed -i "s/#PermitRootLogin prohibit-password/PermitRootLogin yes/" /etc/ssh/sshd_config
9.sed -i "s/#UseDNS no/UseDNS no/" /etc/ssh/sshd_config
9.1 sed -i "s/#UsePAM no/UsePAM yes/" /etc/ssh/sshd_config
10.cp -a /tmp/openssh-8.1p1/contrib/redhat/sshd.init /etc/init.d/sshd
11.cp -a /tmp/openssh-8.1p1/contrib/redhat/sshd.pam /etc/pam.d/sshd.pam(这步不需要)
12.chmod +x /etc/init.d/sshd
13.chkconfig --add sshd
14.systemctl enable sshd
15.mv /usr/lib/systemd/system/sshd.service /root/
16.chkconfig sshd on
17./etc/init.d/sshd restart
18.netstat -lntp|grep sshd|grep 22
19.setenforce 0
20.sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config