1. I want sudo always to be with password request, and it should be like this on every securized system. 2. The solutions I found on the web did not work for me. So, this idea came up after.... : I wrote a very primitif pgm "pwd_ask.c" (hard labour) :
#include <stdlib.h> #include <stdio.h> #include <string.h>
static char string_get(char *prompt, char *string){ int c; printf("%s",prompt); scanf("%s", string); do{ c=getchar();} while (c!='\n' && c != EOF); if(strcmp(string,".")==0){ *string='\0'; return 0; } return 1; }
int main(void){ char* pwd; pwd = malloc(60); string_get("Paswoord : ",pwd); fprintf(stdout,"%s",pwd); free(pwd); return 0; }
with this pgm compiled, in geany I can use the build, execute command (because I need an interactif terminal) like this :
sudo < pwd_ask make
This works, but it would be nice to have the possibility of some interactivity in the c-commands and the independent commands also. It would open a lot of possibilities for other stuff beside sudo also.