02-07-2006
I had a typo which I fixed. It shoulda been 60000. Not too much to this script. The exec sets the script's stdin to /etc/passwd. The "while read" loop just reads the passwd file. The fields are separated by a : and the IFS variable tells "read" statement that. Then if the uid looks good, it issues the command.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have created symbolic links to several frequently used commands, for example:
"lt" is a link to "ls -ltrgo|tail". What can I do to make these links available system-wide, or at least in the directories my coworkers are in most of the time? I have copied the link to several directories, and... (6 Replies)
Discussion started by: jpprial
6 Replies
2. UNIX for Advanced & Expert Users
Does anyone know how to make system wide changes to the CDE's front panel icons? I dont know if it matters but im running Solaris 9.
THanks (1 Reply)
Discussion started by: meyersp
1 Replies
3. UNIX for Dummies Questions & Answers
Hi, I have a task to search for a file called 'Xstartup' in the whole system because there might be different versions of it which overrite eachother.
Can anyone suggest a smart command to run this search ? The machine needs to scan every single folder beginning from root.
Please help, I am... (5 Replies)
Discussion started by: DGoubine
5 Replies
4. UNIX for Dummies Questions & Answers
Using Solaris 9 and 10.
What we want to do is set up global rules for our password files to restrict all users, not only new ones set up with the rules but also the ones that have been sitting on the system for years.
Is there a global way to force all users to change their password every 90... (1 Reply)
Discussion started by: LordJezo
1 Replies
5. HP-UX
Hi all,
Is there any system wide limit on number of user threads. I only find nkthread as a tunable parameter,apart from the `per process limit`. (1 Reply)
Discussion started by: Krsh
1 Replies
6. Linux
Hi,
I need to look for a config file (ldap.conf) and pick the latest modified file.
`locate` tells me there are many ldap.conf's, some in /etc, /usr, /home, etc.
Is there some way I can sort them by last modified time via bash?
I was thinking maybe I could pipe the output of `locate` to `ls... (4 Replies)
Discussion started by: Housni
4 Replies
7. UNIX for Advanced & Expert Users
Dear Fellows;
As being new to linux, i have tried to synamically load a custom library which overrides some system calls like conncet(), socket() etc.... for custom purposes.
It works well, if declaring the environment path LD_PRELOAD and execution of the application to be override... (0 Replies)
Discussion started by: mzeeshan
0 Replies
8. UNIX for Dummies Questions & Answers
We need to have many of our users all send encrypted files to a single FTP server. The problem, if I understand how encryption/decryption works (which I don't), is that each user would normally have their own private and public key. The other end needs to be able to decrypt the file(s) using a... (6 Replies)
Discussion started by: Totengraber
6 Replies
9. Red Hat
Hi everybody,
How can I change the default UMASK for non root users, e.g. I want the umask for every new created user will be 0044.
Thanks (6 Replies)
Discussion started by: leo_ultra_leo
6 Replies
10. Shell Programming and Scripting
When looking for wherever a program or a filename appears in the system, a short scrip is "findinner" which another script calls with a long parameter list consisting of path names ending with ".sh" or ".menu". "findinner" looks like this:
# If not .savenn file, show name and result of grep.
#... (4 Replies)
Discussion started by: wbport
4 Replies
LEARN ABOUT ULTRIX
getpwent
getpwent(3) Library Functions Manual getpwent(3)
Name
getpwent, getpwuid, getpwnam, setpwent, endpwent, setpwfile - get password entry
Syntax
#include <pwd.h>
struct passwd *getpwent()
struct passwd *getpwuid(uid)
uid_t uid;
struct passwd *getpwnam(name)
char *name;
void setpwent()
void endpwent()
void setpwfile(pathname)
char *pathname
Description
The routines, and each return a pointer to an object with the following structure containing the broken-out fields of a line in the pass-
word database:
struct passwd { /* see getpwent(3) */
char *pw_name;
char *pw_passwd;
uid_t pw_uid;
gid_t pw_gid;
int pw_quota;
char *pw_comment;
char *pw_gecos;
char *pw_dir;
char *pw_shell;
};
struct passwd *getpwent(), *getpwuid(), *getpwnam();
The fields pw_quota and pw_comment are unused; the others have meanings described in
A call to has the effect of rewinding the password file to allow repeated searches. may be called to close the password database when pro-
cessing is complete.
The subroutine simply retrieves the next entry while and search until a matching uid or name is found (or until all entries are exhausted).
The subroutine keeps a pointer in the database, allowing successive calls to be used to search the entire database.
A call to must be made before a loop using in order to perform initialization and an must be used after the loop. Both and make calls to
and
The subroutine sets the pathname of the ASCII passwd file and optional hashed database to be used for local passwd lookups. If a passwd
file has been left open by a call to or will close it first. does not directly affect the use of distributed passwd databases.
Restrictions
All information is contained in a static area so it must be copied if it is to be saved.
If YP is running, does not return the entries in any particular order. See the Guide to the Yellow Pages Service for setup information.
The password database may also be distributed via the BIND/Hesiod naming service. See the Guide to the BIND/Hesiod Service for more infor-
mation.
Return Values
Null pointer (0) returned on EOF or error.
Files
See Also
getlogin(3), passwd(5), svc.conf(5)
Guide to the BIND/Hesiod Service
Guide to the Yellow Pages Service
getpwent(3)