I created a Automator Program wich connect me with vpn an sets routes for split tunneling via Shell script.

The Program works fine on Mojave - now with Catalina the call

do shell script "sudo /Users/XXX/Desktop/routen_VPN.sh" with administrator privileges

produces an error

sh: /Users/XXX/Desktop/routen_VPN.sh: Operation not permitted
  • Does it work if you run the command directly from Terminal? – nohillside Sep 25 '19 at 11:10
  • Yes - works like expected in Terminal. – Christian Balog Sep 25 '19 at 11:21
  • Note that you should not use sudo and with administrator privileges together. – red_menace Sep 25 '19 at 13:07
  • No matter if I remove sudo or with administrator privileges - it won't work at all... – Christian Balog Sep 25 '19 at 14:22

Now I have a solution that works for me. If I put the content of the routen_VPN.sh in Automator in AppleScript like this do shell script "content of routen_VPN.sh" with administrator privileges it works fine. Thanks to all who tried to help me with this! :-)

| improve this answer | |

You've created file routen_VPN.sh with the root user as the owner (because you used sudo), which is why you're not permitted to change the permissions as yourself.

Thus, use sudo chmod u+x routen.sh, but note that that will make the file only executable for the root user.

To make the file executable by everyone, use sudo chmod a+x routen.sh.

| improve this answer | |
  • Hi! Thanks for your answer but nothing changed. I've tried both - same error. – Christian Balog Sep 25 '19 at 12:12
  • Have you grant full access for a terminal in Full Disk Access from the Privacy tab under Security & Privacy. – Udhy Sep 25 '19 at 13:51
  • Yes full access is granted – Christian Balog Sep 25 '19 at 14:23
  • Not sure I understand you correctly here. Running a script with sudo has nothing to do with file ownership, and sudo chmod u+x routen.sh will make the file executable by the owner, not by root. Also, if the file is already owned by the current user, you don't need sudo to chmod it. – nohillside Sep 26 '19 at 8:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .