Sponsored Content
Operating Systems AIX script for finding all the users with GID 0 ( admin group ) Post 302334314 by zaxxon on Wednesday 15th of July 2009 08:36:07 AM
Old 07-15-2009
For just having a glance at it:
Code:
sort -t":" -nr -k3,3 /etc/passwd

The users with gid 0 will be listed at the bottom. To reverse remove the -r.


For further usage of the output you might want something like:
Code:
awk -F":" '$3 == 0 {print}' /etc/passwd


This is no AIX specific topic so next time post in the subforum for Shell Scripting please, ty.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Rsync - Preserve owner/group with different UID/GID

Dear Folks :-) I want to rsync some files between some servers and preserve files owner and group (not UID or GID), in some machines UID and GID are differents, for example: a) In the rsync server: # stat vbseo.php File: `vbseo.php' Size: 26758 Blocks: 56 IO... (1 Reply)
Discussion started by: Santi
1 Replies

2. UNIX for Dummies Questions & Answers

Get the gid from a group name

Hi there, One can easily retrieve the uid from a username : id -u $username But how can we easily retrieve the gid from a group name? I mean is there a command without using sed? sed -nr "s/^$groupname:x:(+):.*/\1/p" /etc/group Thanks for your help Santiago (7 Replies)
Discussion started by: chebarbudo
7 Replies

3. AIX

Gid=0 and 7 + admin=FALSE

Checking configuration access files for an AIX server, left me wondering about this :confused:: If a user is added to system group, it gets gid=0 with some security risks because it gets some root kind of file access level. Is this insecure condition kept if the user has admin variable... (0 Replies)
Discussion started by: bkiddo
0 Replies

4. Shell Programming and Scripting

Append users if GID exists

I have thousands of users assigned various roles. The role header defines the GID that they should have. If I can get all the GID information into /etc/group format I can upload the output file and easily assign all users into the desired GID. Right now I can get an output file like this:... (5 Replies)
Discussion started by: MaindotC
5 Replies

5. Red Hat

Problem with Script to email Admin users with expired passwords writed byygemici

Hi, I have problem with a script, it was working for 6 month and suddenly I started getting strange expire times example: # chage -l wXXp Last password change : Oct 28, 2014 Password expires : Nov 27, 2014 Password... (3 Replies)
Discussion started by: redmansas
3 Replies

6. UNIX for Dummies Questions & Answers

Conflicting GID in group and passwd files.

Hi guys, I have a question. In the passwd file, user johndoe has a GID of 100 which is the group named users in the group file. But if you check the group file, johndoe is not listed under GID 100, but under GID 33, which is the group named videos. Under what group does johndoe really belong,... (1 Reply)
Discussion started by: goldenlight1814
1 Replies

7. AIX

UID & GID instead of user name and group name

Hi Everyone, We are encountering the following issue on AIX 5.3. When we do ls -ltr the list displays only user id and group id instead of user name and group name. This is happening for all users except root. Whe we do ls -ltr with root user it shows perfectly fine. When we searched... (25 Replies)
Discussion started by: madhav.kunapa
25 Replies

8. Homework & Coursework Questions

Display info about users (UID GID processes terminal)

I would like to get an opinion for my solution for this task and get feedback about better approach or mistakes I have made. 1. The problem statement, all variables and given/known data: The task is to create a script which prints information about users whose names are specified in the... (2 Replies)
Discussion started by: kornfan
2 Replies

9. HP-UX

Creating a group of users with script

Hi, I have a file with usernames, and the comment section, e.g : Data removed by request of sanchitadutta91, 20 May 2020 I need to add these users into a server. Is it possible to use a script to create the users, together with the comment ? From the commandline to add one user, the... (2 Replies)
Discussion started by: anaigini45
2 Replies
POSIX_GETGRGID(3)							 1							 POSIX_GETGRGID(3)

posix_getgrgid - Return info about a group by group id

SYNOPSIS
array posix_getgrgid (int $gid) DESCRIPTION
Gets information about a group provided its id. PARAMETERS
o $gid - The group id. RETURN VALUES
The array elements returned are: The group information array +--------+---------------------------------------------------+ |Element | | | | | | | Description | | | | +--------+---------------------------------------------------+ | name | | | | | | | The name element contains the name of the group. | | | This is a short, usually less than 16 character | | | "handle" of the group, not the real, full name. | | | | |passwd | | | | | | | The passwd element contains the group's password | | | in an encrypted format. Often, for example on a | | | system employing "shadow" passwords, an asterisk | | | is returned instead. | | | | | gid | | | | | | | Group ID, should be the same as the $gid parame- | | | ter used when calling the function, and hence | | | redundant. | | | | |members | | | | | | | This consists of an array of string's for all | | | the members in the group. | | | | +--------+---------------------------------------------------+ EXAMPLES
Example #1 Example use of posix_getgrgid(3) <?php $groupid = posix_getegid(); $groupinfo = posix_getgrgid($groupid); print_r($groupinfo); ?> The above example will output something similar to: Array ( [name] => toons [passwd] => x [members] => Array ( [0] => tom [1] => jerry ) [gid] => 42 ) SEE ALSO
posix_getegid(3), posix_getgrnam(3), filegroup(3), stat(3), safe_mode_gid, POSIX man page GETGRNAM(3). PHP Documentation Group POSIX_GETGRGID(3)
All times are GMT -4. The time now is 09:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy