SynMoo Posted December 27, 2006 Share Posted December 27, 2006 (edited) I wrote this shell script for myself quickly as I've been moving kexts in and out trying to find the perfect balance. I cleaned it up a bit and figured I'd post it here to help save some keystrokes and some time of those doing that same as I was. You could run diskutility every time, but lets face it, this is quicker for a small batch of files. Basically it RECURSIVELY sets the ownership to root:wheel and permissions to 755 of any file/dir you type as an argument. I personally have named it chode because in my sick mind, that is a combination of chmod and chown. Feel free to mod this however you'd like to suit your needs. It does minimal prerequisite checking: just root and that an argument has been entered. It doesn't check to ensure the file you specified exists or ask you if you're sure so be careful. For those new to shell scripts, I've included a zip below. Place chode.zip on your desktop an unzip it. Then, open terminal and type: mv ~/Desktop/chode /usr/bin/ sudo chown root:wheel /usr/bin/chode sudo chmod 755 /usr/bin/chode Usage: chode file1 file2 file3 etc #!/bin/sh #A quick scribble by SynMoo to simplify specific permissions repair. #Doesn't verify file's existance! Too lazy! #Check for arguments if [ "$*" == "" ]; then echo "Usage: chode target1 ... targetN" exit 127 fi #Check for root if [ "$USER" != "root" ]; then echo "chode: You're not root! Did you sudo?" exit 127 fi #Get busy echo "Setting owner root:wheel recursive..." chown -R root:wheel $* echo "Setting permissions 755 recursive..." chmod -R 755 $* #Visual verification for the paranoid echo "" echo "Verify below:" ls -l $* echo "" echo "Done" Enjoy! chode_fixed.zip Edited December 28, 2006 by SynMoo Link to comment https://www.insanelymac.com/forum/topic/36978-for-those-constantly-changing-ownership-and-permissions/ Share on other sites More sharing options...
SynMoo Posted December 28, 2006 Author Share Posted December 28, 2006 Found a little error in the version in the zip file.. had a trailing quote (") which caused an error. It still works ok, but will toss an error instead of saying done. Attached a fixed version to the original post. Enjoy. Link to comment https://www.insanelymac.com/forum/topic/36978-for-those-constantly-changing-ownership-and-permissions/#findComment-263622 Share on other sites More sharing options...
Recommended Posts