{"id":708,"date":"2012-08-06T04:15:33","date_gmt":"2012-08-06T10:15:33","guid":{"rendered":"http:\/\/blog.supportpro.com\/?p=708"},"modified":"2019-10-30T05:47:42","modified_gmt":"2019-10-30T11:47:42","slug":"upgrading-openssh","status":"publish","type":"post","link":"https:\/\/www.supportpro.com\/blog\/upgrading-openssh\/","title":{"rendered":"Upgrading openssh"},"content":{"rendered":"<p>RHEL5 and CentOS 5 run an older version of ssh, which makes doing a chroot sftp or scp more difficult.<\/p>\n<p><strong>Pre-requisites:-<\/strong><\/p>\n<p>You need to have following packages and it&#8217;s dependencies installed:-<\/p>\n<p>Yum install -y rpm-devel rpm-build pam pam-devel perl openssl-devel tcp-wrappers<\/p>\n<p><strong>Steps:-<\/strong><\/p>\n<p>It is not recommended to build RPM as root user.<\/p>\n<p>1. Login to server using SSH as a normal user.<br \/>\n2. In your home directory create a file .rpmmacros and add following entires to it.<\/p>\n<p>%_topdir %(echo $HOME)\/rpmbuild<\/p>\n<p>3. Next step is creating the build environment. In your home directory, create following directories:-<\/p>\n<p>$mkdir rpmbuild<br \/>\n$cd rpmbuild<br \/>\n$mkdir BUILD RPMS SOURCES SPECS SRPMS<br \/>\n<!--more--><br \/>\n4. Download the latest openssh from their site. http:\/\/filedump.se.rit.edu\/pub\/OpenBSD\/OpenSSH\/portable\/<br \/>\n5. Once it is downloaded, copy the tarball to the rpmbuild\/SOURCES directory that you made.<br \/>\n6. You will also need to extract the tarball and copy over the spec file.<\/p>\n<p>$tar xvf openssh-&lt;version&gt;.tar.gz<br \/>\n$cd openssh-&lt;version&gt;<br \/>\n$cp contrib\/redhat\/openssh.spec $HOME\/rpmbuild\/SPECS<br \/>\n$cd ..<br \/>\n$cp openssh-&lt;version&gt;.tar.gz rpmbuild\/SOURCES<\/p>\n<p>7. Edit the spec file(HOME\/rpmbuild\/SPECS\/openssh.spec).<br \/>\nAlso change<br \/>\n%define no_x11_askpass 0<br \/>\nfrom 0 to 1. We don&#8217;t need the X11 accessories for this.<br \/>\nDo the same with<br \/>\n%define no_gnome_askpass 0<br \/>\nfor the same reason. Lastly, comment out the line<br \/>\n%define build6x 0<br \/>\nAs we&#8217;re not building for RHEL6.<\/p>\n<p>8. Build rpm. In $HOME\/rpmbuild\/SPECS run the following command:-<\/p>\n<p>$rpmbuild -ba openssh.spec<br \/>\nThe above command should build and create several rpms in $HOME\/rpmbuild\/RPMS\/i386<\/p>\n<p>9. In the i386 directory holding the rpms run,<\/p>\n<p>$rpm -Uvh openssh*<br \/>\nIt should update openssh, openssh-server, and openssh-clients.<\/p>\n<p>10. It will also create a new file in \/etc\/ssh called sshd_config.rpmnew. Make sure you have a copy of your old sshd_config. The rest of this will be done as root or with root privilege.<\/p>\n<p>#cd \/etc\/ssh<br \/>\n#cp sshd_config sshd_config.orig<br \/>\n#mv sshd_config.rpmnew sshd_config<\/p>\n<p>11. Restart the SSH service.<\/p>\n<p>#\/etc\/init.d\/sshd restart or<br \/>\n#service sshd restart<\/p>\n<p><strong>How to check the versions of the OpenSSH installed<\/strong><\/p>\n<p>#rpm -qa | grep openssh<\/p>\n<p>If you require help, <a href=\"https:\/\/www.supportpro.com\/requestquote.php\">contact SupportPRO Server Admin<\/a><\/p>\n<p style=\"text-align: center;\"><!--HubSpot Call-to-Action Code --><span id=\"hs-cta-wrapper-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-wrapper\"><span id=\"hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-node hs-cta-9d590242-d641-4383-94b4-8cfd62f0af6b\"><!-- [if lte IE 8]><\/p>\n\n\n\n\n\n<div id=\"hs-cta-ie-element\"><\/div>\n\n\n<![endif]--><a href=\"https:\/\/www.supportpro.com\/freecheckup.php\"><img decoding=\"async\" id=\"hs-cta-img-9d590242-d641-4383-94b4-8cfd62f0af6b\" class=\"hs-cta-img\" style=\"border-width: 0px;\" src=\"https:\/\/no-cache.hubspot.com\/cta\/default\/2725694\/9d590242-d641-4383-94b4-8cfd62f0af6b.png\" alt=\"Server not running properly? Get A FREE Server Checkup By Expert Server Admins - $125 Value\" \/><\/a><\/span><script charset=\"utf-8\" src=\"https:\/\/js.hscta.net\/cta\/current.js\"><\/script><script type=\"text\/javascript\"> hbspt.cta.load(2725694, '9d590242-d641-4383-94b4-8cfd62f0af6b', {}); <\/script><\/span><!-- end HubSpot Call-to-Action Code --><\/p>\n","protected":false},"excerpt":{"rendered":"<p>RHEL5 and CentOS 5 run an older version of ssh, which makes doing a chroot sftp or scp more difficult. Pre-requisites:- You need to have following packages and it&#8217;s dependencies&hellip;<\/p>\n","protected":false},"author":4,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-708","post","type-post","status-publish","format-standard","hentry","category-miscellaneous"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/708","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/comments?post=708"}],"version-history":[{"count":6,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/708\/revisions"}],"predecessor-version":[{"id":4450,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/posts\/708\/revisions\/4450"}],"wp:attachment":[{"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/media?parent=708"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/categories?post=708"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.supportpro.com\/blog\/wp-json\/wp\/v2\/tags?post=708"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}