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

asp.net - Procedure or function "Procedure name" expects a parameter "Param name" which was not supplied occurs rarely -

sql server ce - Is there some way to make sqlce3.5 and 4.0 co-exist in the C# project -

jsp - No mapping found for HTTP request with URI with annotation config Spring MVC and Jetty -