mkdir /software
cd /software
wget https://www.openssl.org/source/old/1.1.1/openssl-1.1.1w.tar.gz
wget --no-check-certificate https://www.openssl.org/source/old/1.1.1/openssl-1.1.1w.tar.gz
yum install -y gcc gcc-c++ glibc make automake autoconf zlib zlib-devel
tar -zxf openssl-1.1.1w.tar.gz
cd openssl-1.1.1w/
./config shared zlib -fPIC --prefix=/usr/local/openssl
make -j 4
make install
mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl /usr/include/openssl.bak
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
ln -s /usr/local/openssl/include/openssl /usr/include/openssl
echo '/usr/local/openssl/lib' > /etc/ld.so.conf.d/openssl-x86_64.conf
ldconfig -v
openssl version -a
安装telnet-server
yum -y install telnet-server
启动并设置开机自启动
systemctl start telnet.socket && systemctl enable telnet.socket
如果有防火墙,则需要放行23端口
firewall-cmd --zone=public --add-port=23/tcp --permanent
添加普通用户并设置密码
useradd huge
echo 123456 | passwd --stdin huge
增加huge账号的sudo权限
在配置文件 /etc/sudoers 中添加配置,但该文件默认是没有写权限的,因此需要先增加写权限
chmod u+w /etc/sudoers
vim /etc/sudoers
huge ALL=(ALL) ALL
上面配置完成后就可以在windows下的终端中使用telnet命令来测试连接
telnet 192.168.0.31 23
wget --no-check-certificate https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.6p1.tar.gz
systemctl stop sshd
mv /etc/ssh /etc/ssh.bak
mv /usr/sbin/sshd /usr/sbin/sshd.bak
mv /usr/bin/ssh /usr/bin/ssh.bak
rpm -qa | grep openssh
rpm -e openssh-clients-7.5p1-1.x86_64 --nodeps
rpm -e openssh-server-7.5p1-1.x86_64
rpm -e openssh-7.5p1-1.x86_64
rpm -e openssh-debuginfo-7.5p1-1.x86_64
(可以试试yum卸载,yum remove openssh)
rpm -qa | grep openssh
yum install -y pcre-devel perl perl-Test-Simple
tar -zxf openssh-9.6p1.tar.gz
cd openssh-9.6p1/
./configure --prefix=/usr/local/openssh --with-ssl-dir=/usr/local/openssl --with-zlib
make -j 4
make install
ls /usr/lib/systemd/system/ssh*
rm -f /usr/lib/systemd/system/ssh*
cp contrib/redhat/sshd.init /etc/init.d/sshd
cp /usr/local/openssh/etc/sshd_config /etc/ssh/sshd_config
cp /usr/local/openssh/sbin/sshd /usr/sbin/sshd
cp /usr/local/openssh/bin/ssh /usr/bin/ssh
cp /usr/local/openssh/bin/ssh-keygen /usr/bin/ssh-keygen
cp /usr/local/openssh/etc/ssh_host_ecdsa_key.pub /etc/ssh/ssh_host_ecdsa_key.pub
systemctl daemon-reload
systemctl start sshd && systemctl enable sshd
ssh -V
vim /etc/ssh/sshd_config
PermitRootLogin yes
systemctl restart sshd
systemctl stop telnet.socket
systemctl disable telnet.socket
rpm -e telnet-server
userdel -r huge
vi /etc/sudoers