SHADOW - Online Linux Manual PageSection : 3
Updated : 03/06/2023
Source : shadow−utils 4​.13
Note : Library Calls

NAMEshadow, getspnam − encrypted password file routines

SYNTAX#include <shadow​.h> struct spwd *getspent(); struct spwd *getspnam(char *name); void setspent(); void endspent(); struct spwd *fgetspent(FILE *fp); struct spwd *sgetspent(char *cp); int putspent(struct spwd *p, FILE *fp); int lckpwdf(); int ulckpwdf();

DESCRIPTIONshadow manipulates the contents of the shadow password file, /etc/shadow​. The structure in the #include file is: struct spwd { char *sp_namp; /* user login name */ char *sp_pwdp; /* encrypted password */ long int sp_lstchg; /* last password change */ long int sp_min; /* days until change allowed​. */ long int sp_max; /* days before change required */ long int sp_warn; /* days warning for expiration */ long int sp_inact; /* days before account inactive */ long int sp_expire; /* date when account expires */ unsigned long int sp_flag; /* reserved for future use */ } The meanings of each field are: •  sp_namp − pointer to null−terminated user name •  sp_pwdp − pointer to null−terminated password •  sp_lstchg − days since Jan 1, 1970 password was last changed •  sp_min − days before which password may not be changed •  sp_max − days after which password must be changed •  sp_warn − days before password is to expire that user is warned of pending password expiration •  sp_inact − days after password expires that account is considered inactive and disabled •  sp_expire − days since Jan 1, 1970 when account will be disabled •  sp_flag − reserved for future use

DESCRIPTIONgetspent, getspname, fgetspent, and sgetspent each return a pointer to a struct spwd​. getspent returns the next entry from the file, and fgetspent returns the next entry from the given stream, which is assumed to be a file of the proper format​. sgetspent returns a pointer to a struct spwd using the provided string as input​. getspnam searches from the current position in the file for an entry matching name​. setspent and endspent may be used to begin and end, respectively, access to the shadow password file​. The lckpwdf and ulckpwdf routines should be used to insure exclusive access to the /etc/shadow file​. lckpwdf attempts to acquire a lock using pw_lock for up to 15 seconds​. It continues by attempting to acquire a second lock using spw_lock for the remainder of the initial 15 seconds​. Should either attempt fail after a total of 15 seconds, lckpwdf returns −1​. When both locks are acquired 0 is returned​.

DIAGNOSTICSRoutines return NULL if no more entries are available or if an error occurs during processing​. Routines which have int as the return value return 0 for success and −1 for failure​.

CAVEATSThese routines may only be used by the superuser as access to the shadow password file is restricted​.

FILES/etc/shadow Secure user account information​.

SEE ALSOgetpwent(3), shadow(5)​.
0
Johanes Gumabo
Data Size   :   16,150 byte
man-shadow.3Build   :   2024-12-05, 20:55   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   3 / 201,640
Visitor ID   :     :  
Visitor IP   :   3.145.44.46   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.