Operating System - HP-UX
1752766 Members
5430 Online
108789 Solutions
New Discussion юеВ

Re: the cmd to chk file permissions for all the users

 
SOLVED
Go to solution
M.P.Chandrasekar
Occasional Advisor

the cmd to chk file permissions for all the users

Hi,
1. whats The command to check the total number of users in HP-UX 11IV1, i got the users in etc/passwd, is there any other way to chkeck the list of users?
2.whats the command to check the file permission for the list of users in HP-UX 11IV1?
8 REPLIES 8
Danny Petterson - DK
Trusted Contributor
Solution

Re: the cmd to chk file permissions for all the users

Hm - If I understand correctly:

Numbers of users:
cat /etc/passwd |wc -l

The second one is a bit weird - but to get filepermissions for all users:

for i in `cat /etc/passwd | awk -F ':' {'print $1'}
do
find / -user $i -exec ls -l \+
done

This will find ALL files owned by each user in /etc/passwd - and list the files with its permssions.

I might have misunderstood the last question, but maybe you can reuse the cmd's to your fit your needs.

Greetings
Danny
M.P.Chandrasekar
Occasional Advisor

Re: the cmd to chk file permissions for all the users

in my second question i want to know the " to which group the users are belonging or what are the users under which group?
M.P.Chandrasekar
Occasional Advisor

Re: the cmd to chk file permissions for all the users

your answers were informative, thanks a lot.
James R. Ferguson
Acclaimed Contributor

Re: the cmd to chk file permissions for all the users

Hi:

> in my second question i want to know the " to which group the users are belonging or what are the users under which group?

# logins -m

...will list users and all of the groups to which they belong. As always, consult the manpages [logins(1M)] for more information.

Regards!

...JRF...
Steven E. Protter
Exalted Contributor

Re: the cmd to chk file permissions for all the users

Shalom,

logins -m seems to show the user id and primary group of each user.

For more complete information, consider these options:

-d Display logins with duplicate UIDs.

-m Show multiple group membership data.

-o Display with alternate format of one line of colon separated
fields.

-p Display logins with no passwords

-s Display all system logins

-t Sort output by login rather than UID.

-u Display all user logins.

-x Display extended information about selected users. This extended information includes home directory, login shell and password aging data, each on its own line. Password information consists
Standard input

Group number information can be obtained in a more compact fashion with the id command


id username

both id and logins data are useful for writing management scripts.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
M.P.Chandrasekar
Occasional Advisor

Re: the cmd to chk file permissions for all the users

hi
thanks, i got what i expected from yours.
James R. Ferguson
Acclaimed Contributor

Re: the cmd to chk file permissions for all the users

HI (again):

For an individual user login, 'id' is useful, indeed. To me, "list of users" [your original words] implies just that: a list; hence my suggestion that you look at 'logins()'. I assume that you found some value to my response although you didn't indicate so.

...JRF...
James R. Ferguson
Acclaimed Contributor

Re: the cmd to chk file permissions for all the users

Hi:

Oh, and another thing:

> SEP: logins -m seems to show the user id and primary group of each user.

No, there is no "seems" about it. Look at the output for 'root' on any server. *All* of the groups to which 'root' belongs are listed.

@ M.P. Not liking an answer is hardly an excuse for not evaluating it. We old-timers see a high correlation between the number of points assigned to an answer and how well the OP wants to hear it.

...JRF...