Re: file handling with fopen() and fclose()



Even with PAM you need to be root.  I had this trouble myself and ended up
writing a helper script that ran suid as root and passed login info via
pipes.  If you are not root, it seems to only auth the user your are
running your script as.

-Michael

On Wed, 27 Feb 2002 Valdis Kletnieks vt edu wrote:

> On Wed, 27 Feb 2002 12:53:53 +0800, John Breen <locutus borg apana org au>  said:
>
> > fp=fopen("/etc/shadow");
>
> SYNOPSIS
>        #include <stdio.h>
>
>        FILE *fopen(const char *path, const char *mode);
>
>
> Might want to pass a mode there, it would SIGSEGV pretty quickly otherwise.
>
> Also, note that /etc/shadow is probably only readable by root - which means
> that you're in for *LOADS* of security fun (you get to run set-UID, or
> run as root, or figure out how to use PAM on systems that support it).
>
> Personally, I think PAM is your best bet if you can use it.
>
> --
> 				Valdis Kletnieks
> 				Computer Systems Senior Engineer
> 				Virginia Tech
>
>




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]