1

I prepared an image and included in /etc/rc.local a line to run a script:

/path/to/myscript.sh

I then created a script at that location

It contains a curl, to download and save a file as new file to the system. After this the file should be executed.

My problem is the following:

The content of the script I included directly to rc.local before and got an error permission denied.
It was the line downloading a scriptfile and save it locally.

Now I started to read further post and all said, it's better to exclude commands to a script file and launch the script file via rc.local only.

But the permissions-problem persists.

So I tried to modify my rc.local line:

/path/to/myscript.sh # not working
sudo /path/to/myscript.sh # not working

also in my script I added sudo to each command, it's not working.

Currently it seems curl with saving a file isn't allowed. (Internet connection exists).

Other posts say I should install a service. Now I think it's going oversized and have no warranty. I need to run the script only once at reboot. In the script I tell the device to download bash-scripts and execute them.

So it seems I have a permission problem and I don't know how to fix it.

Maybe I used the wrong method to run a script after boot.

Why does this problem occur and how to fix ?

  • 2
    Are you sure that the script /path/to/myscript.sh is actually executable? What does ls -l /path/to/myscript.sh say? – AlexP Nov 27 '16 at 10:46
2
# ls test.sh
-rw-r--r-- 1 root root 0 nov 27 13:40 test.sh

# ./test.sh
-su: ./test.sh: permission denied

To solve:

# chmod +x test.sh

Change test.sh for /path/to/myscript.sh

  • Hmm you were a three year member with 1 point. Well now you have 11 points :) – WinEunuuchs2Unix Dec 9 '18 at 17:41
  • Thanks! Will I get the 15 points in the next decade? ;) – Alonso Lara Dec 10 '18 at 20:18

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.