doubleudee1
Posts: 158
Joined: Fri Nov 30, 2018 2:39 pm
Location: Wales

List of users and their rights

Thu Sep 12, 2019 11:13 am

Is there a way I can list all users with all the directories they own or have access too?
Make the most of your family and friends , your children grow up too quickly and you don't notice yourself ageing, friends dissapearing, moving on. You make plans for your future, but they can all be smashed in an instant, live life and enjoy. :)

User avatar
B.Goode
Posts: 8987
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: List of users and their rights

Thu Sep 12, 2019 11:19 am

doubleudee1 wrote:
Thu Sep 12, 2019 11:13 am
Is there a way I can list all users with all the directories they own or have access too?

Examination of /etc/passwd will list all users and their Home directories.

(I concede that is not exactly what you asked, but it might help you come close? I have a feeling you would need to do a recursive search on the entire filesystem checking permissions on every element for a really exhaustive solution.)

markkuk
Posts: 137
Joined: Thu Mar 22, 2018 1:02 pm
Location: Finland

Re: List of users and their rights

Thu Sep 12, 2019 11:36 am

Try this command:

Code: Select all

lslogins -u

doubleudee1
Posts: 158
Joined: Fri Nov 30, 2018 2:39 pm
Location: Wales

Re: List of users and their rights

Thu Sep 12, 2019 11:40 am

Thanks both
Make the most of your family and friends , your children grow up too quickly and you don't notice yourself ageing, friends dissapearing, moving on. You make plans for your future, but they can all be smashed in an instant, live life and enjoy. :)

User avatar
neilgl
Posts: 1186
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: List of users and their rights

Thu Sep 12, 2019 11:48 am

Yes, though this may create a lot of data, for directories owned by a given user

Code: Select all

awk -F":" '{print $1}' /etc/passwd | sort
Then for a given user (e.g. pi):

Code: Select all

sudo find / -type d -user pi 2>/dev/null
repeat for other users.

Return to “Beginners”