#include #include int main() { FILE * fp; char algo[20]={0},key[1000],userHost[100],cha; printf("Key Algorithm? (ssh-rsa,ssh-ed25519,etc.)\n: "); int i=0; fp=fopen("/tmp/ssh_authorized_keys","a"); while((cha=getchar())!='\n'&&cha!=EOF){ algo[i]=cha; i++; } algo[i]='\0'; i=0; while(algo[0]!='.'){ printf("Public Key\n: "); while((cha=getchar())!='\n'&&cha!=EOF){ key[i]=cha; i++; } key[i]='\0'; i=0; printf("Username and Host? (you@example.com)\n: "); while((cha=getchar())!='\n'&&cha!=EOF){ userHost[i]=cha; i++; } userHost[i]='\0'; i=0; fprintf(fp,"%s %s %s\n", algo,key,userHost); printf("Next Key Algorithm? (Enter"); putchar('"'); putchar('.'); putchar('"'); printf("to stop adding keys)\n: "); while((cha=getchar())!='\n'&&cha!=EOF){ algo[i]=cha; i++; } algo[i]='\0'; i=0; } fclose(fp); printf("Output has been saved to /tmp/ssh_authorized_keys\nYou can safely close this window now."); return 0; }