jbeverly / pam_ssh_agent_auth

Moving pam_ssh_agent_auth to github as primary development location
Other
98 stars 27 forks source link

add argument: default_ssh_auth_sock and some fixes #35

Open edward-p opened 2 years ago

edward-p commented 2 years ago

Useful when SSH_AUTH_SOCK can't be set in environment. For example: loging in from a Display Manager (such as SDDM).

kgabor545 commented 2 years ago

Thank you it solved my problem. I can use pam_ssh_auth_sock in polkit-1. I just added a little modification to pam_ssh_agent_auth.c:

#include "misc.h"
...
    if(default_ssh_auth_sock && user) {
       default_ssh_auth_sock = pamsshagentauth_percent_expand(default_ssh_auth_sock,
       "h", getpwnam(user)->pw_dir,
       "u", user, NULL);
    }

I'm not sure this is the way to achieve %h, %u expansion in code, but it does it's job. I make a symlink from the actual socket to the users home with a static name .ssh_auth_sock maybe it could be also a default name if no environment variable.