Changing password using execv
Results 1 to 3 of 3

Thread: Changing password using execv

  1. #1
    Join Date
    Aug 2000
    Location
    Johor Bahru,Johor,Malaysia
    Posts
    46

    Changing password using execv

    Hi...
    I need to change the user's passwd from inside a C program.The execv function seems to be the only way to execute linux commands from inside the program.however running passwd (using execv) is not working.I suppose this is because we cannot specify the arguments on the command line for the password command.Other commands work fine.
    Any way out?
    Thanks for all help in advance.

  2. #2
    Join Date
    Mar 2000
    Location
    Elyria, Ohio - USA
    Posts
    2,075
    If you want to issue the passwd command from within C program, look at system(3). Elsewise, look at getpass(3) for user input and the functions getpwent(3), getpwnam(3) and putpwent(3) for manipulating the /etc/passwd file directly. Hope this helps. -mk

    ------------------
    If it ain't broke, fix it till it is.
    If it ain't broke,
    Fix it till it is.

  3. #3
    Join Date
    Aug 2000
    Location
    Johor Bahru,Johor,Malaysia
    Posts
    46
    Hi,
    the 'system' call works.Thank you.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •