- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- List group/users access
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2001 12:42 PM
11-07-2001 12:42 PM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2001 12:47 PM
11-07-2001 12:47 PM
Solutionusers
find / -user USERNAME -exec ll {} \;
groups
find / -group GROUPNAME -exec ll {} \;
I just threw the -exec part in there but this syntax should work for you.
Good Luck,
C
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2001 12:48 PM
11-07-2001 12:48 PM
Re: List group/users access
to list files/directories
owner by particular user/group
and their permissions:
find $DIR -user
(for group -> change -user
to -group
)
HTH
raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2001 12:49 PM
11-07-2001 12:49 PM
Re: List group/users access
Did you try
find / -user login_name -exec ll {}\;
I don't think there is any equivalent switch for group.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2001 12:50 PM
11-07-2001 12:50 PM
Re: List group/users access
Ooops..no... You have got -group also there... I never used it before....
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2001 12:51 PM
11-07-2001 12:51 PM
Re: List group/users access
OK
for i in `find / -user pipo`
do
echo $i >>filename
ll $i >>filename
echo "##### Next######"
done
Something like this should do it.
Gideon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2001 01:16 PM
11-07-2001 01:16 PM
Re: List group/users access
If you indeed want all files and directories a user / group has permissions to, read the man page for find and look at -perm. I've not used it until just now but testing seems to show that -perm -nnn will show the files and directories with a mininum of the perms you specify. Examples:
find . -perm -001 returns those with at least execute bit on for others. It would return --x, -wx, r-x, and rwx for others without regard for user or group
find . -perm -020 returns those with at least write bit on for group. It would return -w-, -wx, -rw, and rwx for group without regard for user and others
Also, the -nnn syntax will get those with suid and sticky bits as well
Combine -perm syntax with -group and -user to get what you want. For example, to find all files and directories that user userA in group groupA has write on:
find / -user userA
obviously if userA owns it he can change perms to include write
find / -group groupA -perm -020
find / -perm -002
I think this can work. Please test before trusting.
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2001 07:08 AM
11-08-2001 07:08 AM
Re: List group/users access
If using the -exec ll syntax you should make it -exec ll -d {} \; otherwise it will list contents of the matching directories.
I prefer xargs to -exec because it is more performant. xargs takes as many command line args as possible then executes the command once for all those args. If there are more args it will execute the command again for remaining args, and so forth. Test this by comparing the difference between:
timex find . -perm -002 -exec ll -d {} \;
timex find . -perm -002 | xargs ll -d
I did a little more testing with the -perm syntax. It only seems to do AND not OR logic. That is, -perm -007 returns files that are rwx for others, not files that are read, write, execute, OR any combination other than rwx (again, without regard for owner and group permissions). This can get a little cumbersome as shown by the following find commands needed to list all files and directories to which userA in groupA has access of any kind.
find / -user userA | xargs ll -d >/tmp/list
find / -group groupA -perm -010 | xargs ll -d >>/tmp/list
find / -group groupA -perm -020 | xargs ll -d >>/tmp/list
find / -group groupA -perm -030 | xargs ll -d >>/tmp/list
find / -perm -001 | xargs ll -d >>/tmp/list
find / -perm -002 | xargs ll -d >>/tmp/list
find / -perm -003 | xargs ll -d >>/tmp/list
sort -u /tmp/list >list.sorted
I thought that was the answer then I thought about "secondary" groups the user belongs to in /etc/group. You've got to include them so now you have to add something like:
for grp in `grep userA /etc/group | awk -F: '{print $1}'`
do
find / -group $grp -perm -010 | xargs ll -d >>/tmp/list
find / -group $grp -perm -020 | xargs ll -d >>/tmp/list
find / -group $grp -perm -030 | xargs ll -d >>/tmp/list
done
You'd think someone would write a program to do all this. Any takers?
This was probably overkill for your question but I wanted to follow up for my own benefit and then share it with the forums.
One last thing, it's okay and desirable to assign points to all replies to your question, not just the one you choose to use. The first 5 answers to this question were all entered within 4 minutes of each other so please don't disregard them. It would be quite acceptable to give multiple "right" answers 10 points. Also a few points for those where someone tried to answer will encourage them to continue trying.
As for my replies, well it's a case of trying to add more info and completeness for your question. I also spent some time in research which hopefully will help others down the road. And even though I would like some points, I am using my reply just as an example of others where people who spend a little time trying to be helpful should be recognized.
Thanks,
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2001 09:32 AM
11-08-2001 09:32 AM
Re: List group/users access
find / \( -user YOURUSER -o -group YOURGROUP \) -exec ls -ld {} \;
Substitute -a for -o if you want AND.
Note that I used ls -ld so that it picks up directory ownership, and is cross-platform, as solaris doesn't have ll, and I don't know about AIX :-)
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2001 09:36 AM
11-08-2001 09:36 AM
Re: List group/users access
for grp in `grep userA /etc/group | awk -F: '{print $1}'`
do
find / -group $grp -perm -010 | xargs ll -d >>/tmp/list
find / -group $grp -perm -020 | xargs ll -d >>/tmp/list
find / -group $grp -perm -030 | xargs ll -d >>/tmp/list
done
try replacing all those finds with
find / -group $grp \( -perm -010 -o -perm -020 -o -perm -030 \) | xargs ls -ld {} \;
Just my 0.02c since we were talking about performance ;-)
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2001 02:53 PM
11-08-2001 02:53 PM
Re: List group/users access
Nice add-on about using () to group the args. Can't believe I've never used that. I will now!
Darrell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2001 06:00 AM
11-09-2001 06:00 AM
Re: List group/users access
I tried your cmd "find / \( -user YOURUSER -o -group YOURGROUP \) -exec ls -ld {} \;" it came back w/ "bad option" for -o & -a. When I omitted those, I got "missing conjunction" Did I miss something?
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2001 06:12 AM
11-09-2001 06:12 AM
Re: List group/users access
Strange, it works perfectly for me on HP-UX 11.00. What version of HP-UX are you using? Are you able to post your script here so I can take a further look at it?
And are you going to assign points to all the nice people that have posted helping responses? :-)
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2001 06:13 AM
11-09-2001 06:13 AM
Re: List group/users access
There *has* to be a space in between the \( and the -user, and before the \) at the end of the command. Try again and tell me if it works for you now :-)
Cheers,
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2001 06:40 AM
11-09-2001 06:40 AM
Re: List group/users access
The previous admin had all of these cmds in his head. I've been the admin for less than a year and sometimes the syntax for these cmds gets a little confusing. Thanks again for your help.
John