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
/etc/shadow update password entry! ( getspent? ) nighter High Level Programming 2 07-14-2008 03:51 AM
Interpreting the encrypted shadow password? keelba Linux 5 03-12-2008 06:13 PM
shadow file after a password reset progressdll UNIX for Dummies Questions & Answers 0 10-31-2007 02:18 AM
I want to append password in /etc/shadow file modgil Shell Programming and Scripting 5 03-21-2006 09:08 PM
remove shadow password gizaa UNIX for Dummies Questions & Answers 2 08-03-2004 04:30 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 07-14-2008
Registered User
 

Join Date: Jun 2008
Posts: 10
userpw.h AIX ( delete entry from the shadow password database )

HI i need to delete an entry in /etc/security/passwd.
can't find a way to do it with userpw.h api ( AIX ).

the passwd file i delete like this.
Write all entrys to passwd file except the one we are removing.

can't find any function that works like getspent / getpwent do
in AIX userpw api. How do i delete an entry in the shadow file on AIX?

while ((p = getpwent()) != NULL) {
/* Update passwd file if it's not the user we are removing */
if(!(typ==3 && strcmp(p->pw_name,user) == 0)) {
putpwent(p, fpb);
}
}
Reply With Quote
Forum Sponsor
  #2  
Old 07-14-2008
Registered User
 

Join Date: Oct 2007
Location: USA
Posts: 568
On AIX use the setpwdb() / putuserpw() / endpwdb() calls for updating the shadow password file...see their manpages for details.
Reply With Quote
  #3  
Old 07-14-2008
Registered User
 

Join Date: Jun 2008
Posts: 10
Thanks! but i already use those functions to update the shadowfile in
my code and it works!

My problem is that i need to delete an user entry from the shadow file, and putuserpw() dosent work here.

If i had a function that literate over the shadow file as getspent do in linux it would work. But can't find a function that works like that in AIX.
Reply With Quote
  #4  
Old 07-14-2008
Registered User
 

Join Date: Oct 2007
Location: USA
Posts: 568
Does your machine have the /usr/include/shadow.h file on it. The getspent() family of functions are declared in that header file and my guess is that since they are not POSIX compliant AIX excludes them.
Reply With Quote
  #5  
Old 07-15-2008
Registered User
 

Join Date: Jun 2008
Posts: 10
I had to write my own function that removes from /etc/security/passwd.
Cause could not find any solution to that in the api :-(
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




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


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

Content Relevant URLs by vBSEO 3.2.0