{"id":6823,"date":"2022-12-20T19:33:41","date_gmt":"2022-12-20T22:33:41","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/shadow-man3\/"},"modified":"2022-12-20T19:33:41","modified_gmt":"2022-12-20T22:33:41","slug":"shadow-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/shadow-man3\/","title":{"rendered":"SHADOW (man3)"},"content":{"rendered":"<h1 align=\"center\">SHADOW<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNTAX\">SYNTAX<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#DIAGNOSTICS\">DIAGNOSTICS<\/a><br \/> <a href=\"#CAVEATS\">CAVEATS<\/a><br \/> <a href=\"#FILES\">FILES<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">shadow, getspnam \u2212 encrypted password file routines<\/p>\n<h2>SYNTAX <a name=\"SYNTAX\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>#include <shadow.h><\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>struct spwd *getspent();<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>struct spwd *getspnam(char *name);<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>void setspent();<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>void endspent();<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>struct spwd *fgetspent(FILE *fp);<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>struct spwd *sgetspent(char *cp);<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>int putspent(struct spwd *p, FILE *fp);<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>int lckpwdf();<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>int ulckpwdf();<\/i><\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>shadow<\/i> manipulates the contents of the shadow password file, \/etc\/shadow. The structure in the <i>#include<\/i> file is:<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">struct spwd {<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<p>char<\/p>\n<td width=\"26%\"><\/td>\n<td width=\"-18%\"><\/td>\n<td width=\"15%\"><\/td>\n<td width=\"8%\"><\/td>\n<td width=\"7%\"><\/td>\n<td width=\"8%\"> <\/td>\n<td width=\"54%\">\n<p>*sp_namp; \/bin \/boot \/dead.letter \/dev \/etc \/home \/initrd \/lib \/lib64 \/lost+found \/media \/mnt \/opt \/proc \/release-notes.html \/release-notes.txt \/root \/run \/sbin \/srv \/sys \/tmp \/usr \/var user login name bodies\/ usr\/ <br \/> char<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"26%\"><\/td>\n<td width=\"-18%\"><\/td>\n<td width=\"15%\"><\/td>\n<td width=\"8%\"><\/td>\n<td width=\"7%\"><\/td>\n<td width=\"8%\"> <\/td>\n<td width=\"54%\">\n<p>*sp_pwdp; \/bin \/boot \/dead.letter \/dev \/etc \/home \/initrd \/lib \/lib64 \/lost+found \/media \/mnt \/opt \/proc \/release-notes.html \/release-notes.txt \/root \/run \/sbin \/srv \/sys \/tmp \/usr \/var encrypted password bodies\/ usr\/ <br \/> long int<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"26%\"><\/td>\n<td width=\"-18%\"><\/td>\n<td width=\"15%\"><\/td>\n<td width=\"8%\"><\/td>\n<td width=\"7%\"><\/td>\n<td width=\"8%\"> <\/td>\n<td width=\"54%\">\n<p>sp_lstchg; \/bin \/boot \/dead.letter \/dev \/etc \/home \/initrd \/lib \/lib64 \/lost+found \/media \/mnt \/opt \/proc \/release-notes.html \/release-notes.txt \/root \/run \/sbin \/srv \/sys \/tmp \/usr \/var last password change bodies\/ usr\/ <br \/> long int<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"26%\"><\/td>\n<td width=\"-18%\"><\/td>\n<td width=\"15%\"><\/td>\n<td width=\"8%\"><\/td>\n<td width=\"7%\"><\/td>\n<td width=\"8%\"> <\/td>\n<td width=\"54%\">\n<p>sp_min; \/bin \/boot \/dead.letter \/dev \/etc \/home \/initrd \/lib \/lib64 \/lost+found \/media \/mnt \/opt \/proc \/release-notes.html \/release-notes.txt \/root \/run \/sbin \/srv \/sys \/tmp \/usr \/var days until change allowed. bodies\/ usr\/ <br \/> long int<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"26%\"><\/td>\n<td width=\"-18%\"><\/td>\n<td width=\"15%\"><\/td>\n<td width=\"8%\"><\/td>\n<td width=\"7%\"><\/td>\n<td width=\"8%\"> <\/td>\n<td width=\"54%\">\n<p>sp_max; \/bin \/boot \/dead.letter \/dev \/etc \/home \/initrd \/lib \/lib64 \/lost+found \/media \/mnt \/opt \/proc \/release-notes.html \/release-notes.txt \/root \/run \/sbin \/srv \/sys \/tmp \/usr \/var days before change required bodies\/ usr\/ <br \/> long int<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"26%\"><\/td>\n<td width=\"-18%\"><\/td>\n<td width=\"15%\"><\/td>\n<td width=\"8%\"><\/td>\n<td width=\"7%\"><\/td>\n<td width=\"8%\"> <\/td>\n<td width=\"54%\">\n<p>sp_warn; \/bin \/boot \/dead.letter \/dev \/etc \/home \/initrd \/lib \/lib64 \/lost+found \/media \/mnt \/opt \/proc \/release-notes.html \/release-notes.txt \/root \/run \/sbin \/srv \/sys \/tmp \/usr \/var days warning for expiration bodies\/ usr\/ <br \/> long int<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"26%\"><\/td>\n<td width=\"-18%\"><\/td>\n<td width=\"15%\"><\/td>\n<td width=\"8%\"><\/td>\n<td width=\"7%\"><\/td>\n<td width=\"8%\"> <\/td>\n<td width=\"54%\">\n<p>sp_inact; \/bin \/boot \/dead.letter \/dev \/etc \/home \/initrd \/lib \/lib64 \/lost+found \/media \/mnt \/opt \/proc \/release-notes.html \/release-notes.txt \/root \/run \/sbin \/srv \/sys \/tmp \/usr \/var days before account inactive bodies\/ usr\/ <br \/> long int<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"26%\"><\/td>\n<td width=\"-18%\"><\/td>\n<td width=\"15%\"><\/td>\n<td width=\"8%\"><\/td>\n<td width=\"7%\"><\/td>\n<td width=\"8%\"> <\/td>\n<td width=\"54%\">\n<p>sp_expire; \/bin \/boot \/dead.letter \/dev \/etc \/home \/initrd \/lib \/lib64 \/lost+found \/media \/mnt \/opt \/proc \/release-notes.html \/release-notes.txt \/root \/run \/sbin \/srv \/sys \/tmp \/usr \/var date when account expires bodies\/ usr\/ <br \/> unsigned long int<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"26%\"><\/td>\n<td width=\"-18%\"><\/td>\n<td width=\"15%\"><\/td>\n<td width=\"8%\"><\/td>\n<td width=\"7%\"><\/td>\n<td width=\"8%\"><\/td>\n<td width=\"54%\">\n<p>sp_flag; \/bin \/boot \/dead.letter \/dev \/etc \/home \/initrd \/lib \/lib64 \/lost+found \/media \/mnt \/opt \/proc \/release-notes.html \/release-notes.txt \/root \/run \/sbin \/srv \/sys \/tmp \/usr \/var reserved for future use *\/<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:17%;\">}<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The meanings of each field are:<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">\u2022 sp_namp \u2212 pointer to null\u2212terminated user name<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">\u2022 sp_pwdp \u2212 pointer to null\u2212terminated password<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">\u2022 sp_lstchg \u2212 days since Jan 1, 1970 password was last changed<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">\u2022 sp_min \u2212 days before which password may not be changed<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">\u2022 sp_max \u2212 days after which password must be changed<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">\u2022 sp_warn \u2212 days before password is to expire that user is warned of pending password expiration<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">\u2022 sp_inact \u2212 days after password expires that account is considered inactive and disabled<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">\u2022 sp_expire \u2212 days since Jan 1, 1970 when account will be disabled<\/p>\n<p style=\"margin-left:17%; margin-top: 1em\">\u2022 sp_flag \u2212 reserved for future use<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>getspent<\/i>, <i>getspname<\/i>, <i>fgetspent<\/i>, and <i>sgetspent<\/i> each return a pointer to a <i>struct spwd<\/i>. <i>getspent<\/i> returns the next entry from the file, and <i>fgetspent<\/i> returns the next entry from the given stream, which is assumed to be a file of the proper format. <i>sgetspent<\/i> returns a pointer to a <i>struct spwd<\/i> using the provided string as input. <i>getspnam<\/i> searches from the current position in the file for an entry matching <i>name<\/i>.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>setspent<\/i> and <i>endspent<\/i> may be used to begin and end, respectively, access to the shadow password file.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <i>lckpwdf<\/i> and <i>ulckpwdf<\/i> routines should be used to insure exclusive access to the \/etc\/shadow file. <i>lckpwdf<\/i> attempts to acquire a lock using <i>pw_lock<\/i> for up to 15 seconds. It continues by attempting to acquire a second lock using <i>spw_lock<\/i> for the remainder of the initial 15 seconds. Should either attempt fail after a total of 15 seconds, <i>lckpwdf<\/i> returns \u22121. When both locks are acquired 0 is returned.<\/p>\n<h2>DIAGNOSTICS <a name=\"DIAGNOSTICS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Routines return NULL if no more entries are available or if an error occurs during processing. Routines which have <i>int<\/i> as the return value return 0 for success and \u22121 for failure.<\/p>\n<h2>CAVEATS <a name=\"CAVEATS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">These routines may only be used by the superuser as access to the shadow password file is restricted.<\/p>\n<h2>FILES <a name=\"FILES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">\/etc\/shadow<\/p>\n<p style=\"margin-left:17%;\">Secure user account information.<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>getpwent<\/b>(3), <b>shadow<\/b>(5).<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  shadow, getspnam \u2212 encrypted password file routines <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2536],"tags":[2538,3007,1323],"class_list":["post-6823","post","type-post","status-publish","format-standard","hentry","category-3-llamadas-de-bibliotecas","tag-2538","tag-man3","tag-shadow"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6823","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=6823"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/6823\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=6823"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=6823"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=6823"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}