阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

细述CentOS使用OpenSSL编译安装OpenSSH

58次阅读
没有评论

共计 2274 个字符,预计需要花费 6 分钟才能阅读完成。

细述 CentOS 使用 OpenSSL 编译安装 OpenSSH

检测已安装的包
# rpm -qa | grep openssh openssh
# rpm -qa | grep openssh openssl

卸载用 rpm -e 如果出现依赖包导致无法卸载,在最后面加上 –nodeps 即可, 例:

# rpm -e openssl --nodeps

具体安装过程如下:

下载最新软件包源码
http://ftp5.usa.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-7.3p1.tar.gz
http://www.openssl.org/source/openssl-1.0.2j.tar.gz
http://www.openssl.org/source/openssl-fips-2.0.13.tar.gz
使用 YUM 安装必要的软件开发包
# yum install -y zlib-devel pam-devel tcp_wrappers-devel
安装 openssl-fips

具体说明见 http://www.openssl.org/docs/fips ;

# tar zxpf openssl-fips-2.0.5.tar.gz
# cd openssl-fips
# ./config
# make && make install
安装 OpenSSL
# tar zxpf openssl-1.0.1h.tar.gz
# cd openssl-1.0.1h
# ./config fips --shared
# make && make install
将新编译的 openssl library 加入系统动态库链接中
# echo "/usr/local/ssl/lib" >> /etc/ld.so.conf
# ldconfig
安装 OpenSSH
# tar zxpf openssh-6.6p1.tar.gz
# cd openssh-6.6p1
# ./configure \
  --prefix=/usr \
  --sysconfdir=/etc/ssh \
  --with-md5-passwords \
  --with-pam \
  --with-tcp-wrappers \
  --with-ssl-dir=/usr/local/ssl
# make && make install
# ssh -V
修改相关配置
# cp -p contrib/redhat/sshd.init /etc/init.d/sshd    (此处的 contrib 路径为解压后的 OpenSSH 包路径)
# chmod u+x /etc/init.d/sshd(加执行权限)# chkconfig --add sshd(增加 sshd 服务)# chkconfig sshd on(把 sshd 加入启动项)# yum install openssh                                          (安装 OpenSSH 客户端)
# vim /etc/ssh/sshd_config
PermitRootLogin yes                #允许 root 账户登录,单 root 账户必须加上,其他的参数请自行修改 
测试登录
# /etc/init.d/sshd start
ssh-keygen: illegal option -- A

Usage: ssh-keygen [options]

Options:

-a trials   Number of trials for screening DH-GEX moduli.

-B          Show bubblebabble digest of key file.

-b bits     Number of bits in the key to create.

-C comment  Provide new comment.

-c          Change comment in private and public key files.

-e          Convert OpenSSH to IETF SECSH key file.

-F hostname Find hostname in known hosts file.

-f filename Filename of the key file.

-G file     Generate candidates for DH-GEX moduli.

-g          Use generic DNS resource record format.

-H          Hash names in known_hosts file.

-i          Convert IETF SECSH to OpenSSH key file.

-l          Show fingerprint of key file.

-M memory   Amount of memory (MB) to use for generating DH-GEX moduli.

-N phrase   Provide new passphrase.

-P phrase   Provide old passphrase.

-p          Change passphrase of private key file.

-q          Quiet.

-R hostname Remove host from known_hosts file.

-r hostname Print DNS resource record.

-S start    Start point (hex) for generating DH-GEX moduli.

-T file     Screen candidates for DH-GEX moduli.

-t type     Specify type of key to create.

-v          Verbose.

-W gen      Generator to use for generating DH-GEX moduli.

-y          Read private key file and print public key.

Starting sshd:                                             [OK]

sshd 文件的 ssh-keygen 参数有问题,暂时不知道怎么解决,但是不影响使用。

阿里云 2 核 2G 服务器 3M 带宽 61 元 1 年,有高配

腾讯云新客低至 82 元 / 年,老客户 99 元 / 年

代金券:在阿里云专用满减优惠券

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2025-04-01发表,共计2274字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中