Jump to content

Basic chown script


Synthology
 Share

7 posts in this topic

Recommended Posts

Greetings,

 

my current method for repairing permissions after a kext install is as follows:

 

sudo chown -R root:wheel /System/Library/Extensions/

sudo chmod -R 755 /System/Library/Extensions/

sudo rm /System/Library/Extensions.mkext

sudo rm /System/Library/Extensions.kextcache

 

Can someone please enlighten me as to how I can get this as a terminal shell script, so I can just drag and drop it into terminal and it does the rest on its own?

 

Thanks in advance.

Link to comment
Share on other sites

simply create a new text file e.g. with textedit

and then begin it with the following expressions

 

#!/bin/sh

 

after that press returnand insert the code ^^

and safe the script as [scriptName].sh

[scriptName] -> replace by what u want

 

example code:

#!/bin/sh
echo Enter your root password
sudo su
echo You are now logged in as rootuser
chown -R root:wheel /System/Library/Extensions/
chmod -R 755 /System/Library/Extensions/
rm /System/Library/Extensions.mkext
rm /System/Library/Extensions.kextcache
echo Success

 

 

after that just safe the script somewhere and if u need it simply drag it into a clear terminal line

wheres only the prompt ^^ and press enter

 

if your terminal is actually in the same directory as the script simply type ./[scriptName].sh ^^

 

greetz

 

Ichixgo

Link to comment
Share on other sites

Excellent, thank you my friend. This will certainly save some time, and now a days, time is precious.

 

Cheers

 

simply create a new text file e.g. with textedit

and then begin it with the following expressions

 

#!/bin/sh

 

after that press returnand insert the code ^^

and safe the script as [scriptName].sh

[scriptName] -> replace by what u want

 

example code:

#!/bin/sh
echo Enter your root password
sudo su
echo You are now logged in as rootuser
chown -R root:wheel /System/Library/Extensions/
chmod -R 755 /System/Library/Extensions/
rm /System/Library/Extensions.mkext
rm /System/Library/Extensions.kextcache
echo Success

after that just safe the script somewhere and if u need it simply drag it into a clear terminal line

wheres only the prompt ^^ and press enter

 

if your terminal is actually in the same directory as the script simply type ./[scriptName].sh ^^

 

greetz

 

Ichixgo

Link to comment
Share on other sites

simply create a new text file e.g. with textedit

and then begin it with the following expressions

 

#!/bin/sh

 

after that press returnand insert the code ^^

and safe the script as [scriptName].sh

[scriptName] -> replace by what u want

 

example code:

#!/bin/sh
echo Enter your root password
sudo su
echo You are now logged in as rootuser
chown -R root:wheel /System/Library/Extensions/
chmod -R 755 /System/Library/Extensions/
rm /System/Library/Extensions.mkext
rm /System/Library/Extensions.kextcache
echo Success

after that just safe the script somewhere and if u need it simply drag it into a clear terminal line

wheres only the prompt ^^ and press enter

 

if your terminal is actually in the same directory as the script simply type ./[scriptName].sh ^^

 

greetz

 

Ichixgo

 

Thx alot, but there is anyway to auto provide root password and how to trap an error/s or message. e.g. : "There is/are no such file/s to remove" or "file not found to remove".

 

Once again Thax in advance!

Link to comment
Share on other sites

After I created the script, it always gives me an error - Permission Denied -

Perhaps I missed a detail somewhere. Again, any help is most appreciated.

 

Cheers

 

 

After creating a script like that, you'd want to make it executable so you can run it. Do the following and you should be able to execute the script afterwards.

 

chmod +x [scriptname].sh
where [scriptname] is your script

Link to comment
Share on other sites

 Share

×
×
  • Create New...