adding/modding/removing users in linux?

This is a discussion on adding/modding/removing users in linux? within the C++ Programming forums, part of the General Programming Boards category; Hi, I want using my c++ program delete, add and change users on my linux box (the linux-users themself yes). ...

  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    8

    adding/modding/removing users in linux?

    Hi,

    I want using my c++ program delete, add and change users on my linux box (the linux-users themself yes). How should I do this?

  2. #2
    ---
    Join Date
    May 2004
    Posts
    1,379
    Why do you want to program something that your shell can do?

    There is the system() function from <cstdlib> that allows you to call outside programs. Or you could read in and edit the user files manually.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,548
    A simple menu interface calling the useradd, usermod and userdel programs would seem to be in order.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User
    Join Date
    Oct 2005
    Posts
    8
    Quote Originally Posted by Salem
    A simple menu interface calling the useradd, usermod and userdel programs would seem to be in order.
    Yes, that's what I was thinking about as well. However, when I type useradd username, I get different questions, like the password, full name, room number, etc. How can I include these things in the command useradd?

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,548
    Code:
           useradd [-c comment] [-d home_dir]
                   [-e expire_date] [-f inactive_days]
                   [-g initial_group] [-G group[,...]]
                   [-m [-k skeleton_dir] | -M] [-n] [-o] [-p passwd] [-r] [-l]
                   [-s shell] [-u uid] login
    If you specify everything on the command line, do you still get interactive questions?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #6
    Registered User
    Join Date
    Oct 2005
    Posts
    8
    No, no more,

    Thank you

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. graphics for linux users
    By Stonehambey in forum Game Programming
    Replies: 5
    Last Post: 12-12-2008, 02:05 AM
  2. Function validation.
    By Fhl in forum C Programming
    Replies: 10
    Last Post: 02-22-2006, 07:18 AM
  3. Wow! Windows and Linux users please read!
    By Justin W in forum Linux Programming
    Replies: 11
    Last Post: 01-11-2002, 05:06 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21