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.
On Fri, 11 Aug 2023 at 00:12, johannes.janssens--- via Users users@lists.geany.org wrote:
- I want sudo always to be with password request, and it should be like this on every securized system.
- 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.
The compile and build commands output is shown in a list not a terminal because the output is read by Geany and parsed for errors and the relevant line in the output is made active (and red to indicate that) so the user can click it to goto the line where the error occurred, something which cannot be done with a terminal. But because its a list not a terminal typing is not accepted.
Your approach of using the execute commands is the correct one assuming you do not want the output to be parsed for errors.
You can always add more execute commands if you need them, see https://wiki.geany.org/howtos/configurebuildmenu
Cheers Lex
Users mailing list -- users@lists.geany.org To unsubscribe send an email to users-leave@lists.geany.org
Thanks for the explanation. I can live with 'adding more execute commands'. Kind regards.