c - How to add user in Linux with his information -


I want to create a C application for linking the user with the useradd command in Linux.

I write this code while using the terminal print error message:

prefix: useradd: permission denied useradd: / etc / passwd can not lock; Try again later

This is my C code for adding as user as I would like to add user1 to write user1

  char a [50]; Four commands [150]; Fgets (a, sizeof (a), stdin); Strcpy (command, "useradd"); Strcat (order, a);  

How can I solve this problem with the right syntax or command?

If the sudo package is not installed, you can install it . Or you can create it as a root using su . This will ask for the root password after which you can use any superuser camayad.


Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -