一、安装telnet作为备份连接用
yum install telnet-server telnet xinetd
二、启动telnet服务
systemctl start telnet.socket systemctl start xinetd systemctl status telnet.socket systemctl status xinetd
三、修改配置
vim /etc/pam.d/remote
注释掉这行
#auth required pam_securetty.so
四、重启telnet服务
systemctl restart xinetd systemctl restart telnet.socket
五、客户端远程telnet连接测试
六、安装源码编译依赖包
yum install pam-devel openssl-devel zlib zlib-devel
六、备份SSH相关配置
cp /etc/ssh/sshd_config /home/sshd_config.backup cp /etc/pam.d/sshd /home/sshd.backup
七、卸载SSH
rpm -e --nodeps `rpm -qa | grep openssh`
八、下载openssh9.0源码
mkdir /root/openssh cd /root/openssh wget https://mirrors.aliyun.com/pub/OpenBSD/OpenSSH/portable/openssh-9.0p1.tar.gz
九、解压、编译
tar -xf openssh-9.0p1.tar.gz cd openssh-9.0p1 ./configure --prefix=/usr --sysconfdir=/etc/ssh --with-md5-passwords --with-pam --with-zlib --with-tcp-wrappers --with-ssldir=/usr/local/ssl --without-hardening make && make install
十、设置相关文件权限
chmod 600 /etc/ssh/ssh_host_rsa_key chmod 600 /etc/ssh/ssh_host_ecdsa_key chmod 600 /etc/ssh/ssh_host_ed25519_key
十一、复制配置文件
cp -a contrib/redhat/sshd.init /etc/init.d/sshd chmod u+x /etc/init.d/sshd
十二、还原配置
mv /home/sshd.backup /etc/pam.d/sshd mv /home/sshd_config.backup /etc/ssh/sshd_config
十三、修改/etc/ssh/sshd_config
配置文件
打开下面配置
vim /etc/ssh/sshd_config PermitRootLogin yes PubkeyAuthentication yes
十四、 添加自启服务 ssh 到开机启动项
chkconfig --add sshd chkconfig sshd on
十五、重启ssh服务
systemctl restart sshd
十六、查看版本
[root@hlcc-ngim-1 ~]# ssh -V OpenSSH_9.0p1, OpenSSL 1.0.2k-fips 26 Jan 2017
十七、连接测试
翻译
搜索
复制
标签:sshd,--,openssh,telnet,centos7,etc,ssh,9.0 From: https://www.cnblogs.com/sky-cheng/p/18000538