yum install -y gcc openssl-devel pam-devel rpm-build  【下载相关依赖包】

wget http://10.10.8.8/openssl-1.0.2p.tar.gz   【下载ssl,可到相应资源网站去下载最新】

tar -zxvf openssl-1.0.2p.tar.gz && cd openssl-1.0.2p  【解压】

./config --prefix=/usr/local/openssl --shared

make  && 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

ldconfig -v

openssl version -a

cd /root/Desktop

wget http://10.10.8.8/openssh-7.9p1.tar.gz  【下载ssh,到相应资源网站下载】

rpm -e `rpm -qa | grep openssh` --nodeps

tar -zxvf openssh-7.9p1.tar.gz && cd openssh-7.9p1

./configure --prefix=/usr --sysconfdir=/etc/ssh --with-ssl-dir=/usr/local/openssl --with-zlib --with-md5-passwords --with-pam --with-tcp-wrappers  【可能会出现:configure: error: PAM headers not found 错误,需要安装pam-devel的rpm包
# yum install  –y  pam-devel 】

make && make install

sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin\ yes/g' /etc/ssh/sshd_config 【允许root远程登陆】  【sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config】
sed -i 's/#PermitEmptyPasswords\(.*\)/PermitEmptyPasswords\ no/g' /etc/ssh/sshd_config 【禁止空密码】  【sed -i 's/#PermitEmptyPasswords\(.*\)/PermitEmptyPasswords no/g' /etc/ssh/sshd_config】图形化界面可以直接修改

cp contrib/redhat/sshd.init /etc/init.d/sshd
chkconfig --add sshd
chkconfig sshd on
service sshd start
service sshd restart
chkconfig --list sshd
ssh -V
rm -rf /root/Desktop/openssl-1.0.2p.tar.gz
rm -rf /root/Desktop/openssl-1.0.2p
rm -rf /root/Desktop/openssh-7.9p1.tar.gz
rm -rf /root/Desktop/openssh-7.9p1
rm -rf /root/Desktop/w.txt

 

posted on 2019-03-13 15:06  funmixture  阅读(423)  评论(0)    收藏  举报