Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5974647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:58:18+00:00 2026-05-22T20:58:18+00:00

I want to develop an authentication module using PAM, but I’m having trouble getting

  • 0

I want to develop an authentication module using PAM, but I’m having trouble getting a simple example working.

For starters, I would like to do a simple SSH login system where if the user enters the username backdoor, then the user will be logged in without a password (just like in TRON Legacy).

I tried using this guide as a template, but I can’t get it to work. Here is my code so far:

PAM_EXTERN int pam_sm_setcred( pam_handle_t *pamh, int flags, int argc, const char **argv ) {
    return PAM_SUCCESS ;
}

PAM_EXTERN int pam_sm_authenticate( pam_handle_t *pamh, int flags,int argc, const char **argv ) {
    int retval;

    printf("I'm here");

    const char* pUsername;
    retval = pam_get_user(pamh, &pUsername, "Username: ");
    if (retval != PAM_SUCCESS) {
        return retval;
    }

    if (strcmp(pUsername, "backdoor") != 0) {
        return PAM_AUTH_ERR;
    }
    return PAM_SUCCESS;
}

When I log in with the name backdoor, I get permission denied. I’ve tried creating the user account, but I still get prompted for the password.

When I log in with a valid user, I see the “I’m here” printout. Is there a better way to debug something like this or is it mostly trial and error?

EDIT:

I added this to my /etc/pam.d/sshd after @include common-auth:

auth sufficient mypam.so

This comes after 2 other .so files, but I’m pretty sure it’s getting executed every time.

I have not modified pam.conf (there isn’t anything there). I figured that starting with SSH would be easiest because I don’t have to log out each time.

EDIT:

I finally got it working. Here’s the result:

https://github.com/beatgammit/simple-pam

It’s open-source, so if you’re interested, take a look!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T20:58:19+00:00Added an answer on May 22, 2026 at 8:58 pm

    First off, sufficient will still fail if a previous required module has failed. Since you say you have put your sufficient line beneath the include of common-auth you may be seeing a failure because some required module in common-auth has denied access already. Plus you have have sshd getting in the way.

    I’d get all this stuff out of the way so you know your test is really a test of your pam module and not some further interaction with other things. I’d start with a simple test program like the one here with /etc/pam.d/check_user listing your module instead of pam_unix.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to develop facebook client in android using fbrocket api.but,this api only allows
I want to develop a simple web application using Spring Web Flow. The project
I want to develop simple Serverless LAN Chat program just for fun. How can
I want to develop a mobile web application using asp.net 3.5 that can be
I want to develop a very simple 2D game in Python. Pygame is the
I want to develop an iPhone application using the utility template, where the flip
I want to develop a website in ASP classic that uses HTTP Authentication against
I want to develop a Single-Sign-On(SSO) or centralized authentication server (CAS) project for SSO
I want to develop mysql database application using dbexpress to develop from scratch or
I am desperately trying to develop with RIA services, but I want the User

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.