google / google/google-authenticator-libpam

CentOS 6.9 - Failed to update secret file

Open
#93 3 comments 1 reaction 0 assignees View on GitHub
question
Dominant language
C
Stars
2k
Forks
305
PR merge metrics
No merged PRs in 30d

Description

I'm not able to activate google-authenticator on my CentOS server, can you guys help me?

```

[root@xxx log]# cat /etc/redhat-release
CentOS release 6.9 (Final)

[root@xxx log]# tail -f secure
Mar 8 14:00:56 xxx sshd[26942]: Connection closed by 201.6.1.20
Mar 8 14:01:02 xxx sshd(pam_google_authenticator)[26946]: Accepted google_authenticator for fmgodias
Mar 8 14:01:02 xxx sshd(pam_google_authenticator)[26946]: Failed to delete tempfile "/home/fmgodias/.google_authenticator~O40FNf": No such file or directory
Mar 8 14:01:02 xxx sshd(pam_google_authenticator)[26946]: Failed to update secret file "/home/fmgodias/.google_authenticator": Permission denied

[root@xxx tmp]# cat /etc/pam.d/sshd
#%PAM-1.0
auth required pam_google_authenticator.so nullok
auth required pam_sepermit.so
auth include password-auth
account required pam_nologin.so
account include password-auth
password include password-auth
# pam_selinux.so close should be the first session rule
session required pam_selinux.so close
session required pam_loginuid.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session required pam_selinux.so open env_params
session required pam_namespace.so
session optional pam_keyinit.so force revoke
session include password-auth

[root@xxx tmp]# getenforce
Enforcing

```

Install How-To
```
### Compile Google Authenticator
yum remove google-authenticator -y;
yum install qrencode pam-devel make gcc wget autoreconf unzip autoconf automake libtool -y;
mkdir -p /opt/google-authenticator/ ;
cd /opt/google-authenticator/ ;
wget https://github.com/google/google-authenticator-libpam/archive/master.zip -O google-authenticator-libpam.zip ;
unzip google-authenticator-libpam.zip;
cd /opt/google-authenticator/google-authenticator* ;
./bootstrap.sh ;
./configure ;
make && make install ;

# Install Google Authenticator
unlink /usr/bin/google-authenticator ;
unlink /lib64/security/pam_google_authenticator.so ;
unlink /lib64/security/pam_google_authenticator.la ;
ln -s /usr/local/bin/google-authenticator /usr/bin/google-authenticator ;
ln -s /usr/local/lib/security/pam_google_authenticator.so /lib64/security/pam_google_authenticator.so ;
ln -s /usr/local/lib/security/pam_google_authenticator.la /lib64/security/pam_google_authenticator.la ;

# Config SSH Daemon
sed -i '/#%PAM/a auth\ \ \ \ \ \ \ required\ \ \ \ \ pam_google_authenticator.so nullok' /etc/pam.d/sshd ;
sed -i 's/#ChallengeResponseAuthentication\ yes/ChallengeResponseAuthentication\ yes/g' /etc/ssh/sshd_config ;
sed -i 's/ChallengeResponseAuthentication\ no/#ChallengeResponseAuthentication\ no/g' /etc/ssh/sshd_config ;
sed -i 's/#UseDNS\ yes/UseDNS\ no/g' /etc/ssh/sshd_config ;
sed -i 's/#PermitRootLogin\ yes/PermitRootLogin\ no/g' /etc/ssh/sshd_config ;
service sshd restart ;

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.