1.查看当前版本
ssh -V
2.安装 xinetd服务
yum -y install xinetd
3.安装telnet 服务端 客户端
yum -y install telnet telnet-server
4.启动
systemctl start xinetd
systemctl start telnet.socket
vim /etc/pam.d/remote ##注释一行,否则无法远程
5.防火墙
iptables -I INPUT -s 172.16.8.22 -ptcp --dport 23 -j ACCEPT
iptables -nL --line-number
iptables -D INPUT 1
6.下载安装包
wget https://mirrors.aliyun.com/pub/OpenBSD/OpenSSH/portable/openssh-9.2p1.tar.gz
-
装编译环境
yum install -y pam* zlib* openssl-devel gcc make
8. 备份
cp -r /etc/ssh /tmp/
8.编译
./configure --prefix=/usr --sysconfdir=/etc/ssh --with-zlib --with-pam --without-openssl-header-check --with-ssl-dir=/usr/local/ssl --with-privsep-path=/var/lib/sshd
make
rpm -e --nodeps rpm -qa | grep openssh
rm -rf /etc/ssh/*
make install
10
cp -a /etc/init.d/sshd /etc/init.d/sshd20230725
cp -a contrib/redhat/sshd.init /etc/init.d/sshd
chkconfig sshd on
chkconfig --add sshd
systemctl enable sshd
systemctl restart sshd
systemctl stop xinetd
systemctl stop telnet.socket
服务器提示权限拒绝:
编辑文件
vim /etc/ssh/sshd_config
最后一行添加:
HostKeyAlgorithms ssh-rsa,ssh-dss
重启ssh服务
systemctl restart sshd
网友评论