Check the version of old ssh
~]# ssh -V
OpenSSH_4.5p1 FreeBSD-20061110, OpenSSL 0.9.7e-p1 25 Oct 2004
So we need to install openssh using source in different location.
Download the source.
cd /usr/local/src/
wget ftp://ftp3.usa.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-5.9p1.tar.gz
tar -xzvf openssh-5.9p1.tar.gz
cd openssh-5.9p1
Start instalaltion in different location by providng prefix
While compilation there is apossibility t get error regardig missing zlib.h, run yum install zlib-devel if so.
./configure --prefix=/usr/src/openssh5/ --sysconfdir=/etc/ssh2 --with-tcp-wrappers --with-pam
make
make install
To test ssh config, run
/usr/src/openssh5/sbin/sshd -t
To change the prot,
vi /etc/ssh2/sshd_config
and change the default port to test (port 2255)
To start SSH from new location run,
/usr/src/openssh5/sbin/sshd
To check whether it is up, run
sockstat -l | grep ssh
netstat -nat | grep 22
and check for the port we have specified the ssd_config file.
Now we have to replace the old ssh files from its location, here from /usr/bin/
The old ssh files are kept here such ad /usr/bin/ssh
move all those files to a backup file in /home/ssh_bin, such as,
mv /usr/bin/ssh /home/ssh_bin/
mv /usr/bin/sftp /home/ssh_bin/
mv /usr/bin/ssh-add /home/ssh_bin/
mv /usr/bin/ssh-agent /home/ssh_bin/
mv /usr/bin/ssh-keygen /home/ssh_bin/
mv /usr/bin/ssh-keyscan /home/ssh_bin/
and copy it from the new location to /usr/bin
Change the start up script in (/etc/rc.d /sshd)/(/etc/init.d/sshd)with the new config file locations (/etc/ssh2).
Also change the new port to default (22).
Now we have to replace the /usr/sbin/sshd file with new one. To do this,
cp -p /usr/sbin/sshd /home/ssh_bin/
rm /usr/sbin/sshd
cp -p ../sbin/sshd /usr/sbin/
Now try to start sshd,
/etc/rc.d/sshd start
Check whether it is running,
ps aux | grep ssh
check the new version.
ssh -V
Also rename/backup the old config file such as,
mv /etc/ssh /etc/ssh_old
new config file is @ /ect/ssh2
No comments:
Post a Comment