Ubuntu上源码编译openssh
时间: 2024-01-02 10:15:31 浏览: 32
在 Ubuntu 上编译 OpenSSH 的源代码,可以按照以下步骤进行:
1. 安装必要的依赖项:
```shell
sudo apt-get update
sudo apt-get install build-essential libssl-dev zlib1g-dev
```
2. 下载 OpenSSH 的源代码:
```shell
wget https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.6p1.tar.gz
```
3. 解压缩源代码包:
```shell
tar -xzvf openssh-8.6p1.tar.gz
cd openssh-8.6p1
```
4. 配置编译选项:
```shell
./configure --with-ssl-dir=/usr/include/openssl --sysconfdir=/etc/ssh --with-md5-passwords --with-pam
```
其中,`--with-ssl-dir` 选项指定了 OpenSSL 库的安装路径,`--sysconfdir` 选项指定了配置文件的安装路径,`--with-md5-passwords` 选项启用了使用 MD5 密码进行身份验证,`--with-pam` 选项启用了 PAM 模块。
5. 编译并安装:
```shell
make
sudo make install
```
6. 启动 SSH 服务:
```shell
sudo systemctl start ssh
```
现在,你就可以使用新编译的 OpenSSH 了。