Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to set up sshd to do some funky things on a dedicated server. (Which is to say, don't worry about why I'm asking such a strange question; I'm just experimenting to see how I can abuse OpenSSH.)

I'd like to allow a user to log into the system using a made-up name. For instance:

$ ssh joeschmoe@crazysshserver.com

where there's no (UNIX) user on the system named joeschmoe.

When they connect, I'd like them to be logged in as a user which does exist, named guest, and have something in the environment set to joeschmoe so I know who they logged in as.

Is it possible to decouple the notions of UNIX-user and ssh-user?

share|improve this question
    
is this helpful? - serverfault.com/questions/245033/… – LawrenceC Sep 5 '12 at 16:42
    
No, that's the config for ssh, the client. That would let the user type something different, but ultimately ask the server to log them in as a real user. I'm looking for a way for the client to ask to log in as a non-existent user, and have the server decide what user should own the shell that runs. – Peeja Sep 6 '12 at 3:30
    
You would have to monkey around with the systems authentication services (PAM?) to permit unknown users. Major undertaking. – Yedric Sep 17 '12 at 18:09
    
Yep. I'm fine with that. Assume I know how to write a PAM module. Is it possible? – Peeja Sep 17 '12 at 19:24
  1. Install: libpam-script

  2. Add to /etc/pam.d/sshd the following: auth optional pam_script.so

  3. Edit /usr/share/libpam-script/pam_script_auth and make it this:

    #!/bin/bash adduser $PAM_USER --disabled-password --quiet --gecos ""

  4. Make it +x via: chmod +x /usr/share/libpam-script/pam_script_auth

  5. Be happy.

share|improve this answer
    
Won't that add them as a UNIX user? I don't want them to create a new UNIX user; I want them to be logged in as guest. – Peeja Aug 24 '14 at 14:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .