blfs(systemd版本)学习笔记-编译安装openssh软件包

时间:2023-03-10 01:12:37
blfs(systemd版本)学习笔记-编译安装openssh软件包

openssh项目地址:http://www.linuxfromscratch.org/blfs/view/stable/postlfs/openssh.html

1.下载openssh包和补丁并校验md5

wget https://mirror-hk.koddos.net/blfs/8.3/o/openssh-7.7p1.tar.gz

wget http://www.linuxfromscratch.org/patches/blfs/8.3/openssh-7.7p1-openssl-1.1.0-1.patch

md5sum -c md5sums

2.解压并进入openssh包目录

 tar -xvf openssh-7.7p1.tar.gz

cd openssh-7.7p1

3.参照书中说明编译安装

install  -v -m700 -d /var/lib/sshd &&
chown -v root:sys /var/lib/sshd && groupadd -g sshd &&
useradd -c 'sshd PrivSep' \
-d /var/lib/sshd \
-g sshd \
-s /bin/false \
-u sshd patch -Np1 -i ../openssh-.7p1-openssl-1.1.-.patch && ./configure --prefix=/usr \
--sysconfdir=/etc/ssh \
--with-md5-passwords \
--with-privsep-path=/var/lib/sshd &&
make

make tests
make install &&
install -v -m755 contrib/ssh-copy-id /usr/bin && install -v -m644 contrib/ssh-copy-id. \
/usr/share/man/man1 &&
install -v -m755 -d /usr/share/doc/openssh-.7p1 &&
install -v -m644 INSTALL LICENCE OVERVIEW README* \
/usr/share/doc/openssh-.7p1

4.返回blfs-sources目录并删除解压的包目录

cd $LFS/sources/blfs-sources

rm -rf openssh-7.7p1

5.配置openssh

echo "PermitRootLogin no" >> /etc/ssh/sshd_config

6.安装blfs脚本

make install-sshd