如何在 Linux 上安装 Google 身份验证器如何在 Linux 上安装 Google 身份验证器如何在 Linux 上安装 Google 身份验证器如何在 Linux 上安装 Google 身份验证器
  • 文章
  • 正则表达式
    • 工具
  • 登录
找到的结果: {phrase} (显示: {results_count} 共: {results_count_total})
显示: {results_count} 共: {results_count_total}

加载更多搜索结果...

搜索范围
模糊匹配
搜索标题
搜索内容
发表 admin at 2025年2月28日
类别
  • 未分类
标签

如何在 Linux 上安装 Google 身份验证器

问题:我想使用 Google 身份验证器设置两因素身份验证。如何在 [插入您的 Linux 发行版] 上安装 Google Authenticator?

Google Authenticator 是一款可以生成基于时间的一次性密码以用于双因素身份验证的应用程序。您可以在 Linux 上安装 Google Authenticator 作为预构建包或从源代码构建它。

将 Google Authenticator 作为预构建包安装

对于那些不想构建 Google Authenticator 的人,它可以作为多个 Linux 发行版上的预构建包提供。预构建的包包含 Google Authenticator 二进制文件及其 PAM 模块。

在 Ubuntu 上安装 Google 身份验证器


$ sudo apt-get install libpam-google-authenticator

在 Fedora 上安装 Google 身份验证器


$ sudo yum install google-authenticator

在 CentOS 上安装 Google 身份验证器

首先启用 EPEL 存储库,然后运行:


$ sudo yum install google-authenticator

在Linux上编译Google身份验证器

首先,安装构建 Google Authenticator 的先决条件。

在 Debian、Ubuntu 或 Linux Mint 上:


$ sudo apt-get install wget make gcc libpam0g-dev

在 CentOS、Fedora 或 RHEL 上:


$ sudo yum install wget make gcc pam-devel

然后下载Google Authenticator的源码,并编译如下。


$ wget https://google-authenticator.googlecode.com/files/libpam-google-authenticator-1.0-source.tar.bz2
$ tar xvfvj libpam-google-authenticator-1.0-source.tar.bz2
$ cd libpam-google-authenticator-1.0
$ make

如果构建成功,您将在目录中看到创建的 pam_google_authenticator.so 和 google-authenticator。

最后,继续安装 Google Authenticator。


$ sudo make install

有关如何使用 Google Authenticator 为 SSH 登录设置双因素身份验证的说明,请参阅本指南。

故障排除

1. 我在编译 Google Authenticator 时遇到以下错误。


fatal error: security/pam_appl.h: No such file or directory

要解决此问题,请安装以下软件包。

在 Debian、Ubuntu 或 Linux Mint 上:


$ sudo apt-get install libpam0g-dev

在 CentOS、Fedora 或 RHEL 上:


$ sudo yum install pam-devel
©2015-2025 艾丽卡 support@alaica.com