The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
create new user in unix arulkumar UNIX for Dummies Questions & Answers 3 08-28-2007 09:49 PM
create New UNIX User Asteroid UNIX for Dummies Questions & Answers 6 07-24-2007 10:49 PM
Create Unix User wenay Shell Programming and Scripting 6 06-04-2007 11:30 PM
Using a C program to create directories in UNIX aloha_boi High Level Programming 3 11-13-2005 10:11 PM
Other than root user .Normal user is unable to create files mallesh UNIX for Advanced & Expert Users 1 06-22-2005 09:18 AM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 02-28-2006
Registered User
 

Join Date: Feb 2006
Posts: 35
Stumble this Post!
How to create a new unix user in through a c program

Hi ,

I want to create a new user using c program not with unix adduser command .
is it possible to write a cprogram to create a new user account , it should accept username , grouid , group name and all other privilages .

i can use system calls inside c program to do this .

i will execute it in a super user mode .

Many thanks in advance !

Naren
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 03-01-2006
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 3,794
Stumble this Post!
I don't think this is a simple "C" program with a couple of system calls.... It sounds like you're on Linux, so try getting a copy of your distro's source for useradd.
Reply With Quote
  #3 (permalink)  
Old 03-01-2006
Registered User
 

Join Date: Feb 2006
Posts: 35
Stumble this Post!
thanks Jim

Hi Jim ,

Thanks for your response .

no i am in HP-uX 11i, my requirement is whether i can write a cprogram to create unix user account .

is it possible !

thanks once again .

Narendra
Reply With Quote
  #4 (permalink)  
Old 03-02-2006
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 3,794
Stumble this Post!
I'm on HPUX as well. Half the time.
Yes it's trivially possible since it's already been done by HP, but I do not know how.

You have a lot of reading and research to do:

Richard Stevens 'Advanced Programming in the UNIX Environment'
Cooper & More 'HP-UX 11i Internals'

What is the reason you can't use existing HP-provided code?
Reply With Quote
  #5 (permalink)  
Old 03-02-2006
Registered User
 

Join Date: Feb 2006
Posts: 35
Stumble this Post!
Hi Jim ,

Thanks again for your response .

I can use Hp-provided code , but my requirement is that , i should br be able to accept user input from stdin and create a user .

My client wants a mechanisim where he can create users with his login ( if has given the permission of root ) and not by sys admin or root .


anything else let me know !

thanks once again .

Narendra
Reply With Quote
  #6 (permalink)  
Old 03-02-2006
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,424
Stumble this Post!
Just use the HP program useradd. Have your C program construct a useradd command line and then use system() to run the command.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux

Thread Tools
Display Modes




All times are GMT -7. The time now is 11:04 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0