Search Posts on Binpipe Blog

Install OpenSSH 5 in CentOS 5.x

In one of my previous posts http://www.binpipe.com/2012/11/restrict-users-to-home-directory-chroot.html , we had discussed the steps to get an user chrooted to her home directory. For that we need to install open SSH 5.x and above. But as per feedback from some readers I found that most people are having issues upgrading to the latest OpenSSH 5.2 in CentOS 5.x versions. So, here are the steps for installing OpenSSH 5.2 in CentOS 5.x.

Centos 5.x yum doesn’t seem to support latest OpenSSH 5.2 which supports many new features. (The default Openssh version present in Centos 5.x is around 4.2)

Firstly, install the following prerequisites:

# yum install gcc
# yum install openssl-devel
# yum install pam-devel
# yum install rpm-build

And then download openssh 5.2p1

# wget ftp://mirror.planetunix.net/pub/OpenBSD/OpenSSH/portable/openssh-5.2p1.tar.gz

Now, we’re going to build RPM based on tar.gz file:

# tar xvfz openssh-5.2p1.tar.gz
# cp ./openssh-5.2p1/contrib/redhat/openssh.spec /usr/src/redhat/SPECS/
# cp  ./openssh-5.2p1.tar.gz /usr/src/redhat/SOURCES/
# cd /usr/src/redhat/SPECS/
# perl -i.bak -pe 's/^(%define no_(gnome|x11)_askpass)\s+0$/$1 1/' openssh.spec
# rpmbuild -bb openssh.spec
# cd /usr/src/redhat/RPMS/`uname -i`
# ls -l

drwxr-xr-x 2 root root   4096 Jun 30 12:39 .
drwxr-xr-x 9 root root   4096 Jun 30 12:35 ..
-rw-r--r-- 1 root root 271758 Jun 30 12:39 openssh-5.2p1-1.i386.rpm
-rw-r--r-- 1 root root 429852 Jun 30 12:39 openssh-clients-5.2p1-1.i386.rpm
-rw-r--r-- 1 root root 268302 Jun 30 12:39 openssh-server-5.2p1-1.i386.rpm

-rw-r--r-- 1 root root 271758 Jun 30 12:39 openssh-5.2p1-1.i386.rpm
-rw-r--r-- 1 root root 429852 Jun 30 12:39 openssh-clients-5.2p1-1.i386.rpm
-rw-r--r-- 1 root root 268302 Jun 30 12:39 openssh-server-5.2p1-1.i386.rpm

# rpm -Uvh openssh*rpm
Preparing... ################################
1: openssh ####
2: openssh-clients ####
3: openssh-server ####
# service sshd restart

2 comments:

  1. Excellent blog here! Also your site loads up very fast!
    What host are you using? Can I get your affiliate link to your host?
    I wish my website loaded up as quickly as yours lol
    Here is my blog post ; diet that works

    ReplyDelete
  2. Thanks for this.

    I can report that the RPMs build on CentOS 5.9 using openssh-6.3p1.tar.gz

    ReplyDelete

Hi, Leave a comment here and one of the binary piper's will reply soon :)