Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

endpwent(3) [redhat man page]

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

NAME
getpwent, setpwent, endpwent - get password file entry SYNOPSIS
#include <pwd.h> #include <sys/types.h> struct passwd *getpwent(void); void setpwent(void); void endpwent(void); DESCRIPTION
The getpwent() function returns a pointer to a structure containing the broken out fields of a line from /etc/passwd. The first time it is called it returns the first entry; thereafter, it returns successive entries. The setpwent() function rewinds the file pointer to the beginning of the /etc/passwd file. The endpwent() function closes the /etc/passwd file. 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 getpwent() 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, BSD 4.3 SEE ALSO
fgetpwent(3), getpwnam(3), getpwuid(3), getpw(3), putpwent(3), passwd(5) GNU
1996-05-27 GETPWENT(3)

Check Out this Related Man Page

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

NAME
getpwent, setpwent, endpwent - get password file entry SYNOPSIS
#include <pwd.h> #include <sys/types.h> struct passwd *getpwent(void); void setpwent(void); void endpwent(void); DESCRIPTION
The getpwent() function returns a pointer to a structure containing the broken out fields of a line from /etc/passwd. The first time it is called it returns the first entry; thereafter, it returns successive entries. The setpwent() function rewinds the file pointer to the beginning of the /etc/passwd file. The endpwent() function closes the /etc/passwd file. 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 getpwent() 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, BSD 4.3 SEE ALSO
fgetpwent(3), getpwnam(3), getpwuid(3), getpw(3), putpwent(3), passwd(5) GNU
1996-05-27 GETPWENT(3)
Man Page

15 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

etc/passwd

Can anyone explain the second and third fields in /etc/passwd. Thanks. (2 Replies)
Discussion started by: nguda
2 Replies

3. Shell Programming and Scripting

Creating an entry for /etc/passwd

given an input file containing fields seperated by "," how do I retrieve information of these fields, do some work on them, then create a new input to the etc/passwd file? someone told me to look at the "sed" command but I still cant seem to get over this problem. I want to work on the data so... (8 Replies)
Discussion started by: sleepster
8 Replies

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

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

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

7. Shell Programming and Scripting

Scripts for IDīs free in /etc/passwd

As extracting of the file /etc/passwd the IDīs that have not been used in a range specifies. (2 Replies)
Discussion started by: oscar_acm
2 Replies

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

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

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

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

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

13. Shell Programming and Scripting

Maintain health of passwd file

Hello guys I am about to write a script that is based on "The Linux Administration Handbook" The exercise is as follows: Write a shell script to help monitor the health of the /etc/passwd file. Find entries that have UID0 Find entries that have no password (needs /etc/shadow) Find any... (4 Replies)
Discussion started by: Learn4Life
4 Replies

14. Shell Programming and Scripting

awk - printing the passwd file

I've got a number of RHEL systems and I'm trying to use awk to read and format the output of /etc/passwd. But I'd like to display the host name of the system at the beginning of each line of output. I've got it working without the adding the host name in this script: #!/bin/bash ... (3 Replies)
Discussion started by: westmoreland
3 Replies

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