1.查看當(dāng)前版本
ssh -V
2.安裝 xinetd服務(wù)
yum -y install xinetd
3.安裝telnet 服務(wù)端 客戶端
yum -y install telnet telnet-server
4.啟動(dòng)
systemctl start xinetd
systemctl start telnet.socket
vim /etc/pam.d/remote ##注釋一行择镇,否則無法遠(yuǎn)程
自行百度时鸵,我也忘記了
一定要保證使用telnet可以訪問服務(wù)器再升級(jí)sshd冷溶,防止升級(jí)失敗無法訪問服務(wù)器癌蚁;
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(https://mirrors.aliyun.com/pub/OpenBSD/OpenSSH/portable/openssh-9.0p1.tar.gz)
- 裝編譯環(huán)境
yum install -y pam* zlib* openssl-devel gcc make
- 備份
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
服務(wù)器提示權(quán)限拒絕:
編輯文件
vim /etc/ssh/sshd_config
最后一行添加:
HostKeyAlgorithms ssh-rsa,ssh-dss
重啟ssh服務(wù)
systemctl restart sshd
記得一定要設(shè)置允許root遠(yuǎn)程登入!!!
完成赶站!