Here's the source code:
#include <stdio.h> #include <stdlib.h> //Created by Brian Winkler //Create new user int main (void) { char user[128]; char add[128]; printf("Enter a user name:\n"); scanf("%s", user); snprintf(add, sizeof(add), "useradd -m -G users -s /bin/bash %s", user); system(add); printf("User %s created!\n", user); return 0; }
It's a very simple program but through compounding Linux commands, a very powerful program can be created. This program has been tested on Arch Linux and Ubuntu 14.04.
This source code can also be found on my github.
No comments :
Post a Comment