Upgrade and install linuxssh

Source: Internet
Author: User
Tags openssl version ssh server
& Nbsp; 1. install Zlib1 and download the latest ZlibZlib official website: Idea

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 !!

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.