Linxu installation of high performance SSH server

Source: Internet
Author: User
Tags diff ssh openssh server ssh server

Hpn-ssh is a high-performance SSH Server, mainly through the patch patch integration into the openssh to be applied.
According to various official data shows, the performance on the data transmission is 10 times times openssh.
If we use the OpenSSH channel for data transmission, such as through Scp,rsync, then the use of hpn-ssh is a good choice.

My idea is to install hpn-ssh the entire compiler into the/OPT/HPN-SSH directory, while binding the No. 6022 port and specify a specific path of the PID file, so you can and the original system of OpenSSH run at the same time, do not affect each other.

The following are the specific installation and configuration steps:

1. Download OpenSSH
# wget http://ftp5.usa.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-6.1p1.tar.gz

2. Download Hpn-ssh patch

Download hpn SSH Patch for OpenSSH 6.1
http://www.psc.edu/index.php/component/remository/func-startdown/861/

3. Extract OpenSSH and refer to Hpn-ssh patch

# tar XZVF openssh-6.1p1.tar.gz
# gzip-d Openssh-6.1p1-hpn13v14.diff.gz

# CD OPENSSH-6.1P1
# Patch < ... /openssh-6.1p1-hpn13v14.diff
#./configure--prefix=/opt/hpn-ssh
# make
# make Install

4. Modify the configuration file

# Vim/opt/hpn-ssh/etc/sshd_config

Port 6022
Protocol 2
Syslogfacility Authpriv
Permitrootlogin No
Authorizedkeysfile. Ssh/authorized_keys
x11forwarding Yes
#UsePrivilegeSeparation Sandbox # Default for new installations.
Pidfile/opt/hpn-ssh/run/sshd.pid
subsystem Sftp/opt/hpn-ssh/libexec/sftp-server


5. Writing Service Scripts
# vim/etc/init.d/hpn-sshd

#!/bin/bash
#
# Start up the hpn-ssh plugged-in OpenSSH Server daemon
#

Prog=hpn-ssh
Hpn_ssh_home=/opt/hpn-ssh
ssh_keygen= $HPN _ssh_home/bin/ssh-keygen
sshd= $HPN _ssh_home/sbin/sshd
sshd_config= $HPN _ssh_home/etc/sshd_config
pid_file= $HPN _ssh_home/run/sshd.pid

Check_root ()
{
If [$EUID-ne 0]; Then
echo "This script must is run as root" 1>&2
Exit 1
Fi
}

Check_ssh_keys ()
{
if [!-a $HPN _ssh_home/etc/ssh_host_key]; Then
$SSH _keygen-a
Fi
}

Start ()
{
Check_root
Check_ssh_keys
echo $ "Starting $PROG ..."
$SSHD-F $SSHD _config
}

Stop ()
{
Check_root
echo $ "Stopping $PROG ..."
If [-a $PID _file]; Then
Kill-9 ' Cat $PID _file '
Rm-f $PID _file
Else
echo "Pid_file: $PID _file does not exist"
Exit 1
Fi
}

Restart () {
Stop
Start
}

Status () {
  sshd_port= ' grep-e ' ^port ' $SSHD _config '
  running_pid= ' ps aux | grep $SSHD _config | gre P-v grep | awk ' {print $} '
  If [-a $PID _file]; then
    if [-Z $RUNNING _pid]; then
 &nbs p;    echo "Pid_file: $PID _file exists but $PROG is not running"
      exit 1< br>     fi
    Echo $PROG is running in PID: ' Cat $PID _file ' on $SSHD _port '
  E LSE
    Echo "$PROG is stopped"
    exit 1
  FI
}

Case "$" in
Start
Start
Sleep 1
Status
;;
Stop
Stop
Status
;;
Restart)
Restart
;;
Status
Status
;;
*)
echo $ "Usage: $ {Start|stop|restart|status}"
Esac
# chmod +x/etc/init.d/hpn-sshd

6. Start off Hpn-ssh
#/etc/init.d/hpn-sshd Start

Starting hpn-ssh ...

Hpn-ssh is running in pid:19657 on Port 6022


#/etc/init.d/hpn-sshd Stop

Stopping hpn-ssh ...
Hpn-ssh is stopped

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.