wrong shadow and passwd files in /home/*/etc/

equens

Well-Known Member
Feb 8, 2002
283
5
318
I have a problem with owner and group in passwd and shadow files in all entire home directory I am looking for a way to mass update all using the find command, can you help me, please?

/home/user1/etc/domain1/passwd
/home/user1/etc/domain1/shadow

/home/user2/etc/domain2/passwd
/home/user2/etc/domain2/shadow​

I can find these files with
HTML:
find /home/*/etc/*/ -user root
but I dont know how to replace * by username and domain to chown these files with something like
HTML:
chown username:username /home/username/ect/domain/
I have considered to use /scripts/chownpublichtmls but in this server the /home/public_html directory is owned by username but the group is nobody.

Thanks a lot.
 

equens

Well-Known Member
Feb 8, 2002
283
5
318
I'm not sure but I think this will find all files /home/user/etc/ and it will chage the owner and group but, how can I replace user* to do this in the entire home directory?

HTML:
find /home/user/etc/ -user root -print | xargs chown user:mail