openssh/openssh-portable
GitHub: openssh/openssh-portable
便携版 OpenSSH 是 SSH 协议的完整开源实现,提供安全远程登录、命令执行和文件传输功能。
Stars: 3712 | Forks: 2035
# 便携版 OpenSSH
[](../../actions/workflows/c-cpp.yml)
[](../../actions/workflows/vm.yml)
[](https://github.com/openssh/openssh-portable-selfhosted/actions/workflows/selfhosted.yml)
[](../../actions/workflows/cifuzz.yml)
[](https://issues.oss-fuzz.com/issues?q="Project:+openssh"+is:open)
[](https://scan.coverity.com/projects/openssh-portable)
OpenSSH 是 SSH 协议(版本 2)的完整实现,用于安全的远程登录、命令执行和文件传输。它包括客户端 ``ssh`` 和服务器 ``sshd``,文件传输工具 ``scp`` 和 ``sftp``,以及密钥生成工具(``ssh-keygen``)、运行时密钥存储(``ssh-agent``)和许多支持程序。
这是 OpenBSD 的 [OpenSSH](https://openssh.com) 移植到大多数类 Unix 操作系统(包括 Linux、OS X 和 Cygwin)的版本。便携版 OpenSSH 填补了其他地方不可用的 OpenBSD API,为更多操作系统添加了 sshd 沙箱支持,并包括对操作系统原生身份验证和审计的支持(例如使用 PAM)。
## 文档
OpenSSH 的官方文档是每个工具的手册页:
* [ssh(1)](https://man.openbsd.org/ssh.1)
* [sshd(8)](https://man.openbsd.org/sshd.8)
* [ssh-keygen(1)](https://man.openbsd.org/ssh-keygen.1)
* [ssh-agent(1)](https://man.openbsd.org/ssh-agent.1)
* [scp(1)](https://man.openbsd.org/scp.1)
* [sftp(1)](https://man.openbsd.org/sftp.1)
* [ssh-keyscan(8)](https://man.openbsd.org/ssh-keyscan.8)
* [sftp-server(8)](https://man.openbsd.org/sftp-server.8)
## 稳定版本
稳定版本的压缩包可从多个 [下载镜像](https://www.openssh.com/portable.html#downloads) 获取。我们建议大多数用户使用稳定版本。请阅读 [发布说明](https://www.openssh.com/releasenotes.html) 以了解最近的更改和潜在的不兼容性。
## 构建便携版 OpenSSH
### 依赖项
便携版 OpenSSH 使用 autoconf 和 make 构建。它需要一个可用的 C 编译器、标准库和头文件。
也可以使用来自 [LibreSSL](https://www.libressl.org/)、[OpenSSL](https://www.openssl.org)、[AWS-LC](https://github.com/aws/aws-lc) 或 [BoringSSL](https://github.com/google/boringssl) 的 ``libcrypto``。OpenSSH 可以在没有这些库的情况下构建,但生成的二进制文件将只具有通常可用加密算法的一个子集。
[zlib](https://www.zlib.net/) 是可选的;如果没有它,将不支持传输压缩。
FIDO 安全令牌支持需要 [libfido2](https://github.com/Yubico/libfido2) 及其依赖项,如果找到它们将自动启用。
此外,某些平台和构建时选项可能需要额外的依赖项;有关您平台的详细信息,请参阅 README.platform。
### 构建发布版
Git 中的发布压缩包和发布分支包含预构建的 ``configure`` 脚本,可以使用以下命令构建:
```
tar zxvf openssh-X.YpZ.tar.gz
cd openssh
./configure # [options]
make && make tests
```
有关 configure 选项,请参阅下面的 [构建时自定义](#build-time-customisation) 部分。如果您计划将 OpenSSH 安装到您的系统,通常需要指定目标路径。
### 从 git 构建
如果从 git master 分支构建,您需要安装 [autoconf](https://www.gnu.org/software/autoconf/) 来构建 ``configure`` 脚本。以下命令将从 git 检出并构建便携版 OpenSSH:
```
git clone https://github.com/openssh/openssh-portable # or https://anongit.mindrot.org/openssh.git
cd openssh-portable
autoreconf
./configure
make && make tests
```
### 构建时自定义
有许多构建时自定义选项可用。支持所有 Autoconf 目标路径标志(例如 ``--prefix``)(如果您想安装 OpenSSH,通常是必需的)。
要获取可用标志的完整列表,请运行 ``./configure --help``,但下面描述了一些更常用的标志。其中一些标志需要安装额外的库和/或头文件。
标志 | 含义
--- | ---
``--with-pam`` | 启用 [PAM](https://en.wikipedia.org/wiki/Pluggable_authentication_module) 支持。支持 [OpenPAM](https://www.openpam.org/)、[Linux PAM](http://www.linux-pam.org/) 和 Solaris PAM。
``--with-libedit`` | 为 sftp 启用 [libedit](https://www.thrysoee.dk/editline/) 支持。
``--with-kerberos5`` | 启用 Kerberos/GSSAPI 支持。支持 [Heimdal](https://www.h5l.org/) 和 [MIT](https://web.mit.edu/kerberos/) Kerberos 实现。
``--with-selinux`` | 启用 [SELinux](https://en.wikipedia.org/wiki/Security-Enhanced_Linux) 支持。
## 开发
便携版 OpenSSH 的开发在 [openssh-unix-dev 邮件列表](https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev)([归档镜像](https://marc.info/?l=openssh-unix-dev))上讨论。错误和功能请求在我们的 [Bugzilla](https://bugzilla.mindrot.org/) 上跟踪。
## 报告错误
_非安全_ 错误可以通过 [Bugzilla](https://bugzilla.mindrot.org/) 或通过上面的邮件列表报告给开发人员。安全错误应报告给 [openssh@openssh.com](mailto:openssh.openssh.com)。
标签:Awesome, C/C++, HTTP, OpenSSH, SSH, Unix, 事务性I/O, 加密协议, 安全测试工具, 安全通信, 客户端, 客户端加密, 客户端加密, 数字足迹, 文件传输, 服务器, 系统管理, 网络安全, 网络工具, 远程登录, 远程访问, 隐私保护, 隧道