1. 程式人生 > >centos升級openssh

centos升級openssh

centos openssh

1.安裝選項:

--prefix 安裝目錄

--sysconfdir 配置文件目錄

--with-ssl-dir 指定 OpenSSL 的安裝目錄

--with-privsep-path 非特權用戶的chroot目錄

--with-privsep-user=sshd 指定非特權用戶為sshd

--with-zlib 指定zlib庫的安裝目錄

--with-md5-passwords 支持讀取經過MD5加密的口令

--with-ssl-engine 啟用OpenSSL的ENGINE支持


2.編譯安裝

tar zxvf openssh-7.3p1.tar.gz

cd openssh-7.3p1

./configure --prefix=/usr/local/openssh \

--with-zlib \

--with-md5-passwords \

--with-ssl-engine \

--with-ssl-dir=/usr/local/ssl \ centos6.5以下版本編譯openssl的目錄

--without-openssl-header-check \ centos6.5以下版本升級到openssh7.5加此項

--with-tcp-wrappers \

--with-pam


make

make install


3.安裝後的操作

cd /usr/bin

mv scp scp.5.3

mv sftp sftp.5.3

mv slogin slogin.5.3

mv ssh ssh.5.3

mv ssh-add ssh-add.5.3

mv ssh-agent ssh-agent.5.3

mv ssh-keygen ssh-keygen.5.3

mv ssh-keyscan ssh-keyscan.5.3


ln -s /usr/local/openssh/bin/scp scp

ln -s /usr/local/openssh/bin/sftp sftp

ln -s /usr/local/openssh/bin/ssh slogin

ln -s /usr/local/openssh/bin/ssh ssh

ln -s /usr/local/openssh/bin/ssh-add ssh-add

ln -s /usr/local/openssh/bin/ssh-agent ssh-agent

ln -s /usr/local/openssh/bin/ssh-keygen ssh-keygen

ln -s /usr/local/openssh/bin/ssh-keyscan ssh-keyscan


cd /etc/

mv ssh 00-ssh.5.3

ln -s /usr/local/openssh/etc /etc/ssh

mv /etc/init.d/sshd /etc/init.d/sshd.5.3


4.ssh安全設置

vim /etc/ssh/sshd_config

PermitRootLogin no 不允許root遠程登錄

UseDNS no 不使用DNS


5.修改自啟動文件

vim /home/soft/openssh-7.3p1/contrib/redhat/sshd.init

SSHD=/usr/sbin/sshd

/usr/bin/ssh-keygen -A

/sbin/restorecon /etc/ssh/ssh_host_key.pub


修改為:


SSHD=/usr/local/openssh/sbin/sshd

/usr/local/openssh/bin/ssh-keygen -A

#/sbin/restorecon /etc/ssh/ssh_host_key.pub


cp /home/soft/openssh-7.3p1/contrib/redhat/sshd.init /etc/init.d/sshd

/etc/init.d/sshd restart 重啟ssh服務

centos升級openssh