Unix/Linux Go Back    


Solaris The Solaris Operating System, usually known simply as Solaris, is a Unix-based operating system introduced by Sun Microsystems. The Solaris OS is now owned by Oracle.

How to programmatically reset a users password.?

Solaris


Tags
c++, pam, reset password

Closed    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 12-10-2013   -   Original Discussion by ChickenPox
ChickenPox's Unix or Linux Image
ChickenPox ChickenPox is offline
Registered User
 
Join Date: Jul 2012
Last Activity: 30 May 2014, 11:27 AM EDT
Posts: 6
Thanks: 1
Thanked 0 Times in 0 Posts
How to programmatically reset a users password.?

Hello all,
I have a small C++ app for my solaris admins. I need to set it up so they can reset a users password. The admin does not have the old password. How can I reset a users password to a temp password either using passwd or PAM? I need to do this from within my C++ app. I have searched the web over and cannot find how to do this.

Thank you.
Sponsored Links
    #2  
Old Unix and Linux 12-10-2013   -   Original Discussion by ChickenPox
blackrageous's Unix or Linux Image
blackrageous blackrageous is offline
Registered User
 
Join Date: Jul 2013
Last Activity: 12 April 2017, 6:26 PM EDT
Location: Austin, Texas
Posts: 540
Thanks: 13
Thanked 111 Times in 108 Posts
Are going to do a system call inside your C++ program? You can simply use the -f flag to force the uset to change their password after you set it to a temporary one. man passwd
Sponsored Links
    #3  
Old Unix and Linux 12-10-2013   -   Original Discussion by ChickenPox
jim mcnamara's Unix or Linux Image
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
 
Join Date: Feb 2004
Last Activity: 15 January 2018, 9:34 AM EST
Location: NM
Posts: 11,284
Thanks: 581
Thanked 1,126 Times in 1,037 Posts
Rich Teer has pty.c and some related code on hist website. It is essentially a shell script driven expect-like bit of code that creates a "headless" pty.

Go here: http://www.rite-group.com/rich/ssp/

Then download the source code.
    #4  
Old Unix and Linux 12-11-2013   -   Original Discussion by ChickenPox
rbatte1's Unix or Linux Image
rbatte1 rbatte1 is online now Forum Staff  
Root armed
 
Join Date: Jun 2007
Last Activity: 16 January 2018, 10:31 AM EST
Location: Lancashire, UK
Posts: 3,437
Thanks: 1,492
Thanked 671 Times in 604 Posts
A simple

Code:
sudo passwd $user

..... and you are not prompted for the old password. You will be prompted twice for the new password, so verification is taken care of too. Additionally, sudo will write to the syslog for your auditors to drool over.



I hope that this helps,
Robin
Liverpool/Blackburn
UK
Sponsored Links
Closed

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Password reset steadyonabix UNIX for Advanced & Expert Users 4 10-20-2009 10:48 AM
Looking for a script to reset password soliberus Solaris 3 05-11-2008 12:15 PM
I would like to reset my password matrixmadhan Post Here to Contact Site Administrators and Moderators 5 04-30-2007 11:46 PM
Not receiving my reset password whyaskedhere Forum Support Area for Unregistered Users & Account Problems 1 10-16-2005 12:20 PM



All times are GMT -4. The time now is 11:43 AM.