1. Install Zlib
1. download the latest Zlib version.
Zlib Official Website: http://www.zlib.net/
# Cd/usr/local/src
# Wget-c http://www.zlib.net/zlib-1.2.3.tar.gz
2. Compile and install Zlib
# Tar xzvf zlib-1.2.3.tar.gz
# Cd zlib-1.2.3
#./Configure -- prefix =/usr/local/zlib
# Make
# Make install
In this way, compile and install zlib on
/Usr/local/zilib.
Ii. Install OpenSSL
1. download the latest OpenSSL version.
OpenSSL Official Website: http://www.openssl.org
# Cd/usr/local/src
# Wget-c http://www.openssl.org/source/openssl-0.9.8d.tar.gz
2. Compile and install OpenSSL
# Tar xzvf openssl-0.9.8d.tar.gz
# Cd openssl-0.9.8d
#./Configure -- prefix =/usr/local/openssl
# Make
# Make test (this step is very important! It is a complete test of the SSL encryption protocol. If an error occurs, you must first find out the cause. Otherwise, it may lead to the failure of the final SSH service. The consequence is very serious !)
# Make install
3. install OpenSSH
1. download the latest OpenSSH version.
OpenSSH Official Website: http://www.openssh.com
# Cd/usr/local/src
# Wget-c ftp://ftp.it.net.au/mirrors/OpenBSD/OpenSSH/portable/openssh-4.5p1.tar.gz
2. Compile and install OpenSSH
# Tar xzvf openssh-4.5p1.tar.gz
# Cd openssh-4.5p1
#. /Configure -- prefix =/usr -- sysconfdir =/etc/ssh -- with-pam -- with-zlib =/usr/local/zlib -- with-ssl-dir =/usr/local /openssl -- with-md5-passwords
(Note: If the PAM error is prompted during configure, it is generally because the pam-devel RPM package is not installed in the system. Find the installation disc and install pam-devel)
# Make
# Make install
This completes the entire installation of SSH. After the installation is complete, we need to modify the OpenSSH configuration file to further improve security. After completing the installation, the OpenSSH configuration file is under/etc/ssh, And the SSH Server configuration file is sshd_config.
# Vi/etc/ssh/sshd_config
Find:
CODE:
# Modify Protocol 2 and 1:
Protocol 2 disables the ssh v1 Protocol and only uses the more secure ssh v2 Protocol.
Modify X11Forwarding yes:
X11Forwarding no. Disable X11 forwarding.
Save the modification and exit.
● Generate an ssh service management script
Enter the ssh extract directory
# Cd/contrib/redhat
# Cp sshd. init/etc/init. d/sshd
# Chmod + x/etc/init. d/sshd
# Chkconfig -- add sshd
Finally, start the SSH service to make the modification take effect:
#/Etc/init. d/sshd restart
After restart, check whether the current OpenSSH and OpenSSL are correct:
# Ssh-v
If you see a new version number, it will be okay!
Waiting for Supplement:
In practice, the following problems are found:
1. The system prompts Starting sshd: WARNING: initlog is deprecated and will be removed in a future release.
According to the information obtained from foreign websites, initlog-c "$ SNMPD $ OPTIONS" & success | failure
Is "$ SNMPD $ OPTIONS" & success | failure, that is, the previous initlog-c results cannot be solved.
Check the information again and find that the compiled and installed ssh file path needs to be changed when starting the service, and be sure to change the path. Otherwise, an error is returned.
# [-F/etc/sysconfig/sshd] &./etc/sysconfig/sshd
KEYGEN =/usr/local/bin/ssh-keygen
SSHD =/usr/local/sbin/sshd
RSA1_KEY =/usr/local/etc/ssh_host_key
RSA_KEY =/usr/local/etc/ssh_host_rsa_key
DSA_KEY =/usr/local/etc/ssh_host_dsa_key
Please make changes based on your actual situation !!