userpw.h AIX ( delete entry from the shadow password database )


 
Thread Tools Search this Thread
Top Forums Programming userpw.h AIX ( delete entry from the shadow password database )
# 1  
Old 07-14-2008
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);
}
}
# 2  
Old 07-14-2008
On AIX use the setpwdb() / putuserpw() / endpwdb() calls for updating the shadow password file...see their manpages for details.
# 3  
Old 07-14-2008
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.
# 4  
Old 07-14-2008
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.
# 5  
Old 07-15-2008
I had to write my own function that removes from /etc/security/passwd.
Cause could not find any solution to that in the api :-(
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. How to Post in the The UNIX and Linux Forums

Help me, write a bash script to delete parent entry with all their child entry in LDAP UNIX server

Hi All, Please help me and guide me to write a bash/shell script on Linux box to delete parent entry with all their child entries. example: Parent is : ---------- dn: email=yogesh.kumar@wipro.com, o=wipro, o=in child is: ---------- dn: cn: yogesh kumar, email=yogesh.kumar@wipro.com,... (1 Reply)
Discussion started by: Chand
1 Replies

2. Shell Programming and Scripting

Users who have never changed their password from /etc/shadow.

Hello, I have to do a script which returns users who have never changed their password from /etc/shadow. Here is what have I done and I'm not sure if it's ok. I tried to return just users who doesn;t have password set or are locked. Can be there other kind of user who never changed the... (3 Replies)
Discussion started by: catalint
3 Replies

3. Red Hat

Shadow file password policy

Today i was going through some of security guides written on linux . Under shadow file security following points were mentioned. 1)The encrypted password stored under /etc/shadow file should have more than 14-25 characters. 2)Usernames in shadow file must satisfy to all the same rules as... (14 Replies)
Discussion started by: pinga123
14 Replies

4. UNIX for Advanced & Expert Users

/etc/shadow encrypted password

Hi I wonder whether is possible to generate enrypted passwd for some user and paste it into /etc/shadow file ? What kind of encryption is used in /etc/shadow file ? ths for help. (1 Reply)
Discussion started by: presul
1 Replies

5. Solaris

Password Recovery From /etc/shadow file

Is it possible to reset a normal user password , by editing password field in /etc/shadow file? Thanks (6 Replies)
Discussion started by: ksvaisakh
6 Replies

6. UNIX for Dummies Questions & Answers

shadow entry

In /etc/shadow ..we have all the user entries ..? Like when ever an user is created a corresponding entry is created in /etc/shadow...? (2 Replies)
Discussion started by: rachna
2 Replies

7. Solaris

hash password in shadow show 'x' ???

Hello, I want to know the reason behing the scene why some systems have hashed password in /etc/shadow file as "x" not the alienoid language like A1Dksxi3kaA.. (13 characters) As far as I understand, etc/password will show password as "x" and move all hashed password to etc/shadow.... (8 Replies)
Discussion started by: Smith
8 Replies

8. Programming

/etc/shadow update password entry! ( getspent? )

Hi i just whant to update an password entry in /etc/shadow. But dosen't get it to work. Something is wrong! in this code. What i try do do is if user kalle exist in shadow. I whant it to update it's password for just that entry. #include <stdio.h> #include <errno.h> #include <stdlib.h>... (2 Replies)
Discussion started by: nighter
2 Replies

9. UNIX for Dummies Questions & Answers

shadow file after a password reset

hi, I had to reset a lost root password by editing the /etc/passwd and /etc/shadow files ( this is a xen vm file, so i mounted and chrooted the file ) after the reboot with an empty password on root , i have set a new password with passwd but it only changed the /etc/passwd file.... (0 Replies)
Discussion started by: progressdll
0 Replies

10. UNIX for Dummies Questions & Answers

remove shadow password

Does anyone know how to remove a stanza in the shadow password file if the user account has already been removed on an AIX box? I know it can be done by editing the file itself but I would prefer not to do it that way. cheers gizaa (2 Replies)
Discussion started by: gizaa
2 Replies
Login or Register to Ask a Question