Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with recursive chown 1

Status
Not open for further replies.

InigoMontoya

IS-IT--Management
Jun 18, 2003
51
US
account IDs are screwed up on one of our servers. I need to search and chown all files with 1001 account ID to user1.
Anyone have a suggestion how I can do this with minimal code?
 
man find

find / -user 1001 | while read -- FILE
do
print chown username:groupname $FILE
done

when you've tested it, remove the print
 

vi ownchange.sh

find / -user $1 -exec chown $2 {} \;


Run:
chmod 744 ownchange.sh
ownchange.sh 1001 user1


I think this should be most minimal code and suitable for future.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top