help with running popen

Kris Deugau kdeugau at vianet.ca
Tue Apr 3 14:56:53 UTC 2007


This doesn't really look like a PAM question, exactly;  although PAM and 
whatever calls it will determine which UID and GID your module starts 
executing as.

ronald de la cruz wrote:
> hi there...im writing a pam module with encryption using gpg.
> im trying to use popen() to run external command like gpg.
> FILE *fp
> fp = popen("sudo gpg -ear....", "r");
> 
> the problem is, im trying to run this with the sudo command
> but the pam module won't accept it,
> the error is
> 
> sudo: gpg: commant not found
> 
> 
> please help i really need to run gpg with sudo

gpg is a bad example;  it's much more paranoid about the (E)UID and 
(E)GID it runs under.  I don't think sudo will go quite far enough.

Check the command you're trying to run manually;  run it as root, as a 
"full" regular user, and as a restricted user like nobody.  You'll 
probably have to do some additional (E)UID/(E)GID tweaking to get your 
module running as the correct UID/GID for what you want to accomplish.

-kgd




More information about the Pam-list mailing list