Page 1 of 1

Listing UIDs of data in a directory ?

PostPosted: May 20th, '19, 15:54
by vmunich
Hi everyone,

Due to me doing a clean install of Mageia and using backintime to backup/restore users' data, I am not sure that the many files I restored have the right UID.

(since userA on my old system had uid=1003 and the newly created userA on the new system may have uid=1002)

I know I could do a search for data having a certain uid:

Code: Select all
find /directory_to_be_search -uid 1002


but what I really want is to find out which UIDs are allocated in data of a given directory ("directory /directory_to_be_search contains data with UID 1002, 1005, 1008")

Any hint ?

Thank you
Vincent

Re: Listing UIDs of data in a directory ?

PostPosted: May 20th, '19, 19:20
by alf
vmunich wrote:Any hint ?

Code: Select all
ls -n

Re: Listing UIDs of data in a directory ?

PostPosted: May 20th, '19, 23:47
by doktor5000
That's not really possible, at least not with find, as it can either search for arbitrary UID numbers, or the other way around it can search for files that are not owned by a user via -nouser.

What you could do is search for everything that is not owned by your user / group, which should also achieve what you want.
E.g. if your user/group would be called vmunich
Code: Select all
find /directory_to_be_searched \( ! -user vmunich -o ! -group vmunich \) -ls