Sponsored Content
Top Forums Programming userpw.h AIX ( delete entry from the shadow password database ) Post 302214700 by shamrock on Monday 14th of July 2008 06:21:23 PM
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.
 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
GETSPNAM(3)						     Linux Programmer's Manual						       GETSPNAM(3)

NAME
getspnam, getspnam_r, getspent, getspent_r, setspent, endspent, fgetspent, fgetspent_r, sgetspent, sgetspent_r, putspent, lckpwdf, ulckpwdf - get shadow password file entry SYNOPSIS
/* General shadow password file API */ #include <shadow.h> struct spwd *getspnam(const char *name); struct spwd *getspent(void); void setspent(void); void endspent(void); struct spwd *fgetspent(FILE *stream); struct spwd *sgetspent(const char *s); int putspent(const struct spwd *p, FILE *stream); int lckpwdf(void); int ulckpwdf(void); /* GNU extension */ #include <shadow.h> int getspent_r(struct spwd *spbuf, char *buf, size_t buflen, struct spwd **spbufp); int getspnam_r(const char *name, struct spwd *spbuf, char *buf, size_t buflen, struct spwd **spbufp); int fgetspent_r(FILE *stream, struct spwd *spbuf, char *buf, size_t buflen, struct spwd **spbufp); int sgetspent_r(const char *s, struct spwd *spbuf, char *buf, size_t buflen, struct spwd **spbufp); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): getspent_r(), getspnam_r(), fgetspent_r(), sgetspent_r(): Since glibc 2.19: _DEFAULT_SOURCE Glibc 2.19 and earlier: _BSD_SOURCE || _SVID_SOURCE DESCRIPTION
Long ago it was considered safe to have encrypted passwords openly visible in the password file. When computers got faster and people got more security-conscious, this was no longer acceptable. Julianne Frances Haugh implemented the shadow password suite that keeps the encrypted passwords in the shadow password database (e.g., the local shadow password file /etc/shadow, NIS, and LDAP), readable only by root. The functions described below resemble those for the traditional password database (e.g., see getpwnam(3) and getpwent(3)). The getspnam() function returns a pointer to a structure containing the broken-out fields of the record in the shadow password database that matches the username name. The getspent() function returns a pointer to the next entry in the shadow password database. The position in the input stream is initial- ized by setspent(). When done reading, the program may call endspent() so that resources can be deallocated. The fgetspent() function is similar to getspent() but uses the supplied stream instead of the one implicitly opened by setspent(). The sgetspent() function parses the supplied string s into a struct spwd. The putspent() function writes the contents of the supplied struct spwd *p as a text line in the shadow password file format to stream. String entries with value NULL and numerical entries with value -1 are written as an empty string. The lckpwdf() function is intended to protect against multiple simultaneous accesses of the shadow password database. It tries to acquire a lock, and returns 0 on success, or -1 on failure (lock not obtained within 15 seconds). The ulckpwdf() function releases the lock again. Note that there is no protection against direct access of the shadow password file. Only programs that use lckpwdf() will notice the lock. These were the functions that formed the original shadow API. They are widely available. Reentrant versions Analogous to the reentrant functions for the password database, glibc also has reentrant functions for the shadow password database. The getspnam_r() function is like getspnam() but stores the retrieved shadow password structure in the space pointed to by spbuf. This shadow password structure contains pointers to strings, and these strings are stored in the buffer buf of size buflen. A pointer to the result (in case of success) or NULL (in case no entry was found or an error occurred) is stored in *spbufp. The functions getspent_r(), fgetspent_r(), and sgetspent_r() are similarly analogous to their nonreentrant counterparts. Some non-glibc systems also have functions with these names, often with different prototypes. Structure The shadow password structure is defined in <shadow.h> as follows: struct spwd { char *sp_namp; /* Login name */ char *sp_pwdp; /* Encrypted password */ long sp_lstchg; /* Date of last change (measured in days since 1970-01-01 00:00:00 +0000 (UTC)) */ long sp_min; /* Min # of days between changes */ long sp_max; /* Max # of days between changes */ long sp_warn; /* # of days before password expires to warn user to change it */ long sp_inact; /* # of days after password expires until account is disabled */ long sp_expire; /* Date when account expires (measured in days since 1970-01-01 00:00:00 +0000 (UTC)) */ unsigned long sp_flag; /* Reserved */ }; RETURN VALUE
The functions that return a pointer return NULL if no more entries are available or if an error occurs during processing. The functions which have int as the return value return 0 for success and -1 for failure, with errno set to indicate the cause of the error. For the nonreentrant functions, the return value may point to static area, and may be overwritten by subsequent calls to these functions. The reentrant functions return zero on success. In case of error, an error number is returned. ERRORS
EACCES The caller does not have permission to access the shadow password file. ERANGE Supplied buffer is too small. FILES
/etc/shadow local shadow password database file /etc/.pwd.lock lock file The include file <paths.h> defines the constant _PATH_SHADOW to the pathname of the shadow password file. ATTRIBUTES
For an explanation of the terms used in this section, see attributes(7). +--------------+---------------+--------------------------------+ |Interface | Attribute | Value | +--------------+---------------+--------------------------------+ |getspnam() | Thread safety | MT-Unsafe race:getspnam locale | +--------------+---------------+--------------------------------+ |getspent() | Thread safety | MT-Unsafe race:getspent | | | | race:spentbuf locale | +--------------+---------------+--------------------------------+ |setspent(), | Thread safety | MT-Unsafe race:getspent locale | |endspent(), | | | |getspent_r() | | | +--------------+---------------+--------------------------------+ |fgetspent() | Thread safety | MT-Unsafe race:fgetspent | +--------------+---------------+--------------------------------+ |sgetspent() | Thread safety | MT-Unsafe race:sgetspent | +--------------+---------------+--------------------------------+ |putspent(), | Thread safety | MT-Safe locale | |getspnam_r(), | | | |sgetspent_r() | | | +--------------+---------------+--------------------------------+ |lckpwdf(), | Thread safety | MT-Safe | |ulckpwdf(), | | | |fgetspent_r() | | | +--------------+---------------+--------------------------------+ In the above table, getspent in race:getspent signifies that if any of the functions setspent(), getspent(), getspent_r(), or endspent() are used in parallel in different threads of a program, then data races could occur. CONFORMING TO
The shadow password database and its associated API are not specified in POSIX.1. However, many other systems provide a similar API. SEE ALSO
getgrnam(3), getpwnam(3), getpwnam_r(3), shadow(5) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. GNU
2017-09-15 GETSPNAM(3)
All times are GMT -4. The time now is 08:52 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy