command line 'passwd' command
Results 1 to 4 of 4

Thread: command line 'passwd' command

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

    command line 'passwd' command

    Hi..
    what I need to do is this: change a user's password from a C program.
    I am thinking on the lines of using the system() call to call this command, as I have used the same to create new users(system(useradd....))
    the problem is the "passwd" command is interactive..is there any way I can specify the password(or output of
    crypt(password,salt)) and remove the interactivity?
    Gnome has the change password option..so I think there should be a way...
    Thanks in advance!

    ps. The "useradd" command was also interactive,but it had a -p option to specify the password (ie, output of crypt(password,salt) )while creating user so that removed the interactivity.

    [This message has been edited by sujita (edited 06-21-2001).]

  2. #2
    Join Date
    Feb 2001
    Location
    Adelaide, South Australia
    Posts
    6,447
    Look into the chpass command and its -p switch instead of passwd.
    Safe computing is a habit, not a toolkit.

  3. #3
    Join Date
    Aug 2000
    Location
    Johor Bahru,Johor,Malaysia
    Posts
    46
    hi,
    thanks a lot.It works,though there's one minor hitch : only root can run chpasswd.Users can't change their passwords this way..any suggestions for this?
    Sujita

  4. #4
    Join Date
    Feb 2001
    Location
    Adelaide, South Australia
    Posts
    6,447
    There's no other commands I know of. If you can write it securely enough (and I'm not familiar enough with that side of Unix C programming to say whether or not it's possible) then you could get around it by writing a small program to just do the password change and make it SUID root. Of course, that requires a way to verify the user's identity that can't be spoofed, which is where the biggest catch would be.

    Maybe someone else can suggest a better solution.
    Safe computing is a habit, not a toolkit.

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
  •