Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

fgetpwent(3) [redhat man page]

FGETPWENT(3)						     Linux Programmer's Manual						      FGETPWENT(3)

NAME
fgetpwent - get password file entry SYNOPSIS
#include <pwd.h> #include <stdio.h> #include <sys/types.h> struct passwd *fgetpwent(FILE *stream); DESCRIPTION
The fgetpwent() function returns a pointer to a structure containing the broken out fields of a line in the file stream. The first time it is called it returns the first entry; thereafter, it returns successive entries. The file stream must have the same format as /etc/passwd. The passwd structure is defined in <pwd.h> as follows: struct passwd { char *pw_name; /* user name */ char *pw_passwd; /* user password */ uid_t pw_uid; /* user id */ gid_t pw_gid; /* group id */ char *pw_gecos; /* real name */ char *pw_dir; /* home directory */ char *pw_shell; /* shell program */ }; RETURN VALUE
The fgetpwent() function returns the passwd structure, or NULL if there are no more entries or an error occurs. ERRORS
ENOMEM Insufficient memory to allocate passwd structure. FILES
/etc/passwd password database file CONFORMING TO
SVID 3 SEE ALSO
getpwnam(3), getpwuid(3), getpwent(3), setpwent(3), endpwent(3), getpw(3), putpwent(3), passwd(5) GNU
1996-05-17 FGETPWENT(3)

Check Out this Related Man Page

FGETPWENT(3)						     Linux Programmer's Manual						      FGETPWENT(3)

NAME
fgetpwent - get password file entry SYNOPSIS
#include <stdio.h> #include <sys/types.h> #include <pwd.h> struct passwd *fgetpwent(FILE *stream); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): fgetpwent(): _SVID_SOURCE DESCRIPTION
The fgetpwent() function returns a pointer to a structure containing the broken out fields of a line in the file stream. The first time it is called it returns the first entry; thereafter, it returns successive entries. The file referred to by stream must have the same format as /etc/passwd (see passwd(5)). The passwd structure is defined in <pwd.h> as follows: struct passwd { char *pw_name; /* username */ char *pw_passwd; /* user password */ uid_t pw_uid; /* user ID */ gid_t pw_gid; /* group ID */ char *pw_gecos; /* real name */ char *pw_dir; /* home directory */ char *pw_shell; /* shell program */ }; RETURN VALUE
The fgetpwent() function returns a pointer to a passwd structure, or NULL if there are no more entries or an error occurs. ERRORS
ENOMEM Insufficient memory to allocate passwd structure. FILES
/etc/passwd password database file CONFORMING TO
SVr4. SEE ALSO
endpwent(3), fgetpwent_r(3), fopen(3), getpw(3), getpwent(3), getpwnam(3), getpwuid(3), putpwent(3), setpwent(3), passwd(5) COLOPHON
This page is part of release 3.25 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. GNU
2008-07-10 FGETPWENT(3)
Man Page

11 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

UNIX/Win passwd synchronization utility

I know I saw a couple posts about this a long time ago, but could not find them with search. Please refresh my memory. -Chuck (1 Reply)
Discussion started by: 98_1LE
1 Replies

2. UNIX for Dummies Questions & Answers

passwd file contents

Hi All Here is a the enty for my user on a UNIX from the /etc/passwd file, i want to know what each field denotes where can i get to know it? kankipas:!:275:1:Swaraj Kankipati - Brea PTX Support:/home/kankipas:/usr/bin/ksh If anyone could tell me that would be great Thanks Swaraj (5 Replies)
Discussion started by: kswaraj
5 Replies

3. Shell Programming and Scripting

Filter passwd

Hello, I have to build a temp. passwd-file without looked passwd entries in the /etc/passwd. The looked passwd fields have an "*" in the passwd-filed (2nd field). I think, it's possible to solve this problem with a small awk, but I don't know how ??? Normal users lines should be still in... (11 Replies)
Discussion started by: Topsurfer
11 Replies

4. UNIX for Dummies Questions & Answers

nobody & noaccess entries in passwd file

Hi, I cud find entries for user's named nobody and noaccess in the passwd file in the Unix system in which I am working ... I have seen entries for these in other systems too .... What is the significance for nobody and noaccess ... ?? Anything special ?? Can anyone help ?? Thanks &... (1 Reply)
Discussion started by: Sabari Nath S
1 Replies

5. Shell Programming and Scripting

how to extract fields for /etc/passwd

hi, i would like to extract the just name field from /etc/passwd file, and nothing else. ie grep pauline, and Pauline Fowler comes back. cheeers paul mc (6 Replies)
Discussion started by: mopimp
6 Replies

6. UNIX for Dummies Questions & Answers

Creating a copy of the /etc/passwd file

Is there a command for creating a copy of the /etc/passwd file named "./copy-passwd" that contains only the entries for userids that have a home directory in /home/inst, and change each entry in your copy so that the default login shell is /bin/sh. (2 Replies)
Discussion started by: raidkridley
2 Replies

7. UNIX for Advanced & Expert Users

creating a file by editing another one?

BASH shell: I'm trying to create a copy of the /etc/passwd file named "./copy-passwd" that contains only the entries for userids that have a home directory in /home/inst, and then change each entry in the copy so that the default login shell is /bin/sh. Would "sed" be the best choice of file... (1 Reply)
Discussion started by: raidkridley
1 Replies

8. Shell Programming and Scripting

/etc/passwd

Hello All I want to print only the full name from the /etc/passwd file and print it to the screen . Could you please let me know how can I do that? (4 Replies)
Discussion started by: supercops
4 Replies

9. Shell Programming and Scripting

Manipulating the etc/passwd file with sed

How can i use sed to extract the user name and home directory from the /etc/passwd/ file on my server. (11 Replies)
Discussion started by: Pauline mugisha
11 Replies

10. UNIX for Dummies Questions & Answers

How to extract fields from etc/passwd file?

Hi! i want to extract from /etc/passwd file,the user and user info fileds, to a another file.I've tried this: cut -d ':' -f1 ':' -f6 < file but cut can be used to extract olny one field and not two. maybe with awk is this possible? (4 Replies)
Discussion started by: strawhatluffy
4 Replies

11. UNIX for Advanced & Expert Users

Passing parameter inside the expression

Hello, i need to pass the variable in place of pwd. how to display variable in the bleow syntax. suppose, passwd="test", then 'id/$passwd..... FEDFlagResult=`sqlplus -S 'id/pwd@(DESCRIPTION= (ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1643))(CONNECT_DATA= (SID=peta1)))'<< EOF select... (4 Replies)
Discussion started by: balareddy
4 Replies