shadowのヘルプ・マニュアル
日本語 英語
shadow --help
man shadow
SHADOW(3) SHADOW(3)
名前
shadow - 暗号化されたパスワードファイル用ルーチン
書式
#include
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();
説明
shadow は shadow パスワードファイル /etc/shadow の内容を操作するルーチ
ンである。 #include ファイルに与えられている構造体は以下の通り。
struct spwd {
char *sp_namp; /* user login name */
char *sp_pwdp; /* encrypted password */
long sp_lstchg; /* last password change */
int sp_min; /* days until change allowed. */
int sp_max; /* days before change required */
int sp_warn; /* days warning for expiration */
int sp_inact; /* days before account inactive */
int sp_expire; /* date when account expires */
int sp_flag; /* reserved for future use */
}
各フィールドの意味は:
sp_namp - ヌル終端されたユーザ名文字列へのポインタ
sp_pwdp - ヌル終端されたパスワード文字列へのポインタ
sp_lstchg - 1970年1月1日からパスワード最終変更日時迄の日数
sp_min - パスワード変更が出来るようになるまでの日数
sp_max - パスワードを変更しなくても良い日数
sp_warn - パスワードが期限切れになる前に、期限切れが近づいている旨の 警
告をユーザに出す期間の日数
sp_inact - パスワードが期限切れになってから、アカウントが不能となり使用
できなくなるまでの日数
sp_expire - 1970年1月1からアカウントが使用不能となる日迄の日数
sp_flag - 将来使うときに向けて予約
説明
getspent, getspname, fgetspent, sgetspent は、それぞれ struct spwd への
ポインタを返す。 getspent はファイルから次のエントリを、 fgetspent は指
定されたストリーム (正しい書式のファイルとみなされる) から次のエント リ
を 返す。 sgetspent は入力として与えられた文字列を用いて struct spwd へ
のポインタを返す。 getspnam はファイル中の現在の位置から name にマッ チ
するエントリを探す。
setspent は shadow パスワードファイルへのアクセスを開始するために、
endspent は終了するために用いられる。
/etc/shadow ファイルに対する排他的なアクセスを保証したい場合には、 lck-
pwdf ルーチンと ulckpwdf ルーチンを用いる。 lckpwdf は pw_lock を用いて
最大 15 秒間ロックを取得しようとする。そして最初の 15 秒の残り の 間 、
spw_lock によって二度目のロックをしようと試み続ける。計 15 秒間の間にい
ずれかの試みが失敗した場合は、 lckpwdf は -1 を返す。いずれのロックも成
功した場合は 0 が返される。
返り値
こ れらのルーチンは、エントリが残っていない場合や、処理の過程でエラーが
発生した場合には NULL を返す。返り値が int であるルーチンは、成功したら
0 を、失敗したら -1 を返す。
警告
shadow されたパスワードファイルへのアクセスは制限されているので、これら
のルーチンはスーパーユーザだけが利用できる。
ファイル
/etc/shadow - 暗号化されたユーザパスワード
関連項目
getpwent(3), shadow(5)
著者
Julianne Frances Haugh (jockgrrl@ix.netcom.com)
SHADOW(3)
SHADOW(3) Library Calls SHADOW(3)
NAME
shadow, getspnam - encrypted password file routines
SYNTAX
#include
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();
DESCRIPTION
shadow 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
DESCRIPTION
getspent, 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.
DIAGNOSTICS
Routines 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.
CAVEATS
These 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 ALSO
getpwent(3), shadow(5).
shadow-utils 4.1.5.1 05/10/2016 SHADOW(3)