Hi,
I am new to Linux programming.
I am trying to add a module that will be run as additional rule to PAM.
My current goal is to create a logging system, but I am having problem on permission on writing my log.
PAM_EXTERN int pam_sm_authenticate( pam_handle_t *pamh, int flags,int argc, const char **argv ) {
FILE * fp = fopen("/var/log/fmepam.log","a");
if(fp != NULL)
{
fprintf(fp, "Hello World!\n");
fclose(fp);
}
else
{
printf("failed to create file\n");
}
return PAM_SUCCESS;
}
Actually I will face more permission problem later on my code, since I will be needing to run an executable,
that will run my custom Face Detection in user space. But I think, first step is to have logging system so I can know what problems am i facing on actual log in.
I hope I can find any leads to solve my problem. Thank in advance.
I am new to Linux programming.
I am trying to add a module that will be run as additional rule to PAM.
My current goal is to create a logging system, but I am having problem on permission on writing my log.
PAM_EXTERN int pam_sm_authenticate( pam_handle_t *pamh, int flags,int argc, const char **argv ) {
FILE * fp = fopen("/var/log/fmepam.log","a");
if(fp != NULL)
{
fprintf(fp, "Hello World!\n");
fclose(fp);
}
else
{
printf("failed to create file\n");
}
return PAM_SUCCESS;
}
Actually I will face more permission problem later on my code, since I will be needing to run an executable,
that will run my custom Face Detection in user space. But I think, first step is to have logging system so I can know what problems am i facing on actual log in.
I hope I can find any leads to solve my problem. Thank in advance.