# Help error=13, Permission denied

**URL:** <https://community.openhab.org/t/help-error-13-permission-denied/122529>\
**Category:** Tutorials & Examples\
**Created:** [May 19, 2021, 3:05pm UTC](https://community.openhab.org/t/help-error-13-permission-denied/122529 "2021-05-19T15:05:55Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![mp718](https://community.openhab.org/user_avatar/community.openhab.org/mp718/32/59847_2.png) [@mp718](https://community.openhab.org/u/mp718)\
**Post date:** [May 19, 2021, 3:05pm UTC](https://community.openhab.org/t/help-error-13-permission-denied/122529/1 "2021-05-19T15:05:55Z")

</div>

Continuing the discussion from [Disable internet connection of specific echo device on fritz box via script](https://community.openhab.org/t/disable-internet-connection-of-specific-echo-device-on-fritz-box-via-script/91374):

Hi,  
I tried to change the userprofile with the command which you discribe. But I always get a arrow in the Log file.  
Herer are my source code

```auto
rule "echoesszimmeranaus"
when
	Item echoanaus changed
then
	createTimer(now) [|
		if (echoanaus.state == OFF) {
			executeCommandLine("/etc/openhab2/scripts/fritzboxprofile.sh 192.168.178.1 password filtprof1071 never", 5000)
		} else {
			executeCommandLine("/etc/openhab2/scripts/fritzboxprofile.sh 192.168.178.1 password filtprof1071 unlimited", 5000)
		}
	]
end

```

```auto
#!/bin/sh

challenge=$(curl -s "http://$1/login_sid.lua?username=admin" | grep -Po '(?<=<Challenge>).*?(?=</Challenge>)')
md5=$(echo -n ${challenge}"-"$2 | iconv -f ISO8859-1 -t UTF-16LE | md5sum -b | awk '{print substr($0,1,32)}') 
response="${challenge}-${md5}"
sid=$(curl -i -s -k -d "response=${response}&username=admin" "http://$1" | grep -Po -m 1 '(?<=sid=)[a-f\d]+' | tail -1)

curl -d "sid=${sid}&edit=$3&time=$4&budget=unlimited&apply=&page=kids_profileedit" "http://$1/data.lua" >/dev/null 2>&1

```

For the username I tried also a second which has admin rights.

This is the warning message at the log

```auto
[WARN] [lipse.smarthome.io.net.exec.ExecUtil] - Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program "/etc/openhab2/scripts/fritzboxprofile.sh" (in directory "."): error=13, Permission denied)

```

Maybe anybody can help me?

Best Regards

---

<div class="post-metadata">

**Author:** ![rossko57](https://community.openhab.org/user_avatar/community.openhab.org/rossko57/32/70263_2.png) [@rossko57](https://community.openhab.org/u/rossko57)\
**Post date:** [May 19, 2021, 4:25pm UTC](https://community.openhab.org/t/help-error-13-permission-denied/122529/2 "2021-05-19T16:25:12Z")

</div>

ExecuteCommandLine syntax varies by openHAB version, so let’s clear that up first.

---

<div class="post-metadata">

**Author:** ![Wolfgang\_S](https://community.openhab.org/user_avatar/community.openhab.org/wolfgang_s/32/52719_2.png) [@Wolfgang\_S](https://community.openhab.org/u/Wolfgang_S)\
**Post date:** [May 19, 2021, 6:30pm UTC](https://community.openhab.org/t/help-error-13-permission-denied/122529/3 "2021-05-19T18:30:35Z")

</div>

> [@mp718](#):
>
> Maybe anybody can help me?

Do you get this message in case you add

```php
cd /tmp

```

between "#/bin/sh and the row that starts with “challenge=” ?

---

<div class="post-metadata">

**Author:** ![Trinitus01](https://community.openhab.org/user_avatar/community.openhab.org/trinitus01/32/55944_2.png) [@Trinitus01](https://community.openhab.org/u/Trinitus01)\
**Post date:** [May 19, 2021, 6:53pm UTC](https://community.openhab.org/t/help-error-13-permission-denied/122529/4 "2021-05-19T18:53:01Z")

</div>

Hi,

did you check the owner and the permission of the file “fritzboxprofile.sh”? You can run “ls -l” in the directory of the file and post the output.

br

---

<div class="post-metadata">

**Author:** ![mp718](https://community.openhab.org/user_avatar/community.openhab.org/mp718/32/59847_2.png) [@mp718](https://community.openhab.org/u/mp718)\
**Post date:** [May 20, 2021, 5:35pm UTC](https://community.openhab.org/t/help-error-13-permission-denied/122529/5 "2021-05-20T17:35:17Z")

</div>

I had add sudo in the commando line

```auto
executeCommandLine("sudo /etc/openhab2/scripts/fritzboxprofile.sh password filtprof1071 never", 5000)

```

So I haven’t an Error on the Log but the userrights aren’t changing in the Fritzbox.  
I had made a special user in Fritzbox for chaging the userright. I hope this is correct

---

<div class="post-metadata">

**Author:** ![rossko57](https://community.openhab.org/user_avatar/community.openhab.org/rossko57/32/70263_2.png) [@rossko57](https://community.openhab.org/u/rossko57)\
**Post date:** [May 20, 2021, 6:56pm UTC](https://community.openhab.org/t/help-error-13-permission-denied/122529/6 "2021-05-20T18:56:58Z")

</div>

Still applies

> [@rossko57](#):
>
> ExecuteCommandLine syntax varies by openHAB version

> [@Trinitus01](#):
>
> You can run “ls -l” in the directory of the file and post the output.

You can also check for responses

```auto
var results = executeCommandLine( ... blah ... )
logInof ("test", "My exec returned " + results)

```

---

<div class="post-metadata">

**Author:** ![mp718](https://community.openhab.org/user_avatar/community.openhab.org/mp718/32/59847_2.png) [@mp718](https://community.openhab.org/u/mp718)\
**Post date:** [May 22, 2021, 10:56am UTC](https://community.openhab.org/t/help-error-13-permission-denied/122529/7 "2021-05-22T10:56:15Z")

</div>

It looks like that the EXEC Binding isn’t installed.

```auto
Off sudo: /etc/openhab2/scripts/fritzboxprofile.sh: command not found
I use openhabe 2.5 and I can't install the EXEC Binding over Paper UI. Is there an additional way to install it

Sorry I thought that the Binding is installed. I Tried it and I didn't receive an error message in Log

```

---

<div class="post-metadata">

**Author:** ![mp718](https://community.openhab.org/user_avatar/community.openhab.org/mp718/32/59847_2.png) [@mp718](https://community.openhab.org/u/mp718)\
**Post date:** [May 22, 2021, 10:56am UTC](https://community.openhab.org/t/help-error-13-permission-denied/122529/8 "2021-05-22T10:56:59Z")

</div>

Format Error  
Herr is the code again, Sorry

```auto
Off sudo: /etc/openhab2/scripts/fritzboxprofile.sh: command not found

```

---

<div class="post-metadata">

**Author:** ![Wolfgang\_S](https://community.openhab.org/user_avatar/community.openhab.org/wolfgang_s/32/52719_2.png) [@Wolfgang\_S](https://community.openhab.org/u/Wolfgang_S)\
**Post date:** [May 22, 2021, 1:59pm UTC](https://community.openhab.org/t/help-error-13-permission-denied/122529/9 "2021-05-22T13:59:25Z")

</div>

- executeCommandLine is an action
- exec binding is a binding that needs to be installed
- executeCommandLine is not part of the exec binding
- according to your code snippets you use executeCommandLine which does not require the exec binding to be installed
- command not found means that a file / binary or shell script that is to be executed cannot be found
- as the shell script ( fritzboxprofile.sh ) is before the colon this should mean that your shell script is started to be executed but a command from inside of that shell script is not found
- you can use a PATH variable inside of the script and add all relevant directories to that environment variable
- alternatively you may always use full path to any executeable/script/command
- add debug output to your script that ‘every’ line creates output once the error message appears you should be able to identify which command is the root cause ( because you can see the debug output of the line before )

---

<div class="post-metadata">

**Author:** ![mp718](https://community.openhab.org/user_avatar/community.openhab.org/mp718/32/59847_2.png) [@mp718](https://community.openhab.org/u/mp718)\
**Post date:** [May 22, 2021, 6:18pm UTC](https://community.openhab.org/t/help-error-13-permission-denied/122529/10 "2021-05-22T18:18:05Z")

</div>

At first thank you for helping

I found the problem. The userrights are rong. The had only read and writte access.

No I have the next problem. It’s still not changing the user in then fritzbaox. But I no error occur.  
How can I debugg the script?

---

<div class="post-metadata">

**Author:** ![Wolfgang\_S](https://community.openhab.org/user_avatar/community.openhab.org/wolfgang_s/32/52719_2.png) [@Wolfgang\_S](https://community.openhab.org/u/Wolfgang_S)\
**Post date:** [May 22, 2021, 8:47pm UTC](https://community.openhab.org/t/help-error-13-permission-denied/122529/11 "2021-05-22T20:47:46Z")

</div>

> [@mp718](#):
>
> How can I debugg the script?

You can add addtional rows to the script like:

```php
echo $challenge > /tmp/debug.txt
echo $md5 >> /tmp/debug.txt
echo $sid >> /tmp/debug.txt

```

they need to be added after the related variable is set.  
Output will be stored in directory /tmp in file debug.txt.

To see result of the last curl command

```php
>/dev/null

```

can be replaced with

```php
>>/tmp/debug.txt

```

Pay attention to \> versus \>\>. The first one creates/overwrites a file. The second one appends output to the end of the file.

---

<div class="post-metadata">

**Author:** ![mp718](https://community.openhab.org/user_avatar/community.openhab.org/mp718/32/59847_2.png) [@mp718](https://community.openhab.org/u/mp718)\
**Post date:** [May 23, 2021, 10:32am UTC](https://community.openhab.org/t/help-error-13-permission-denied/122529/12 "2021-05-23T10:32:25Z")

</div>

I found the problem.  
A slash was missing in the fritzprofile.sh 😉  
Thank you very much for helping me

---

<div class="post-metadata">

**Author:** ![system](https://community-openhab-org.s3-eu-central-1.amazonaws.com/original/2X/6/6a52f2ac5d00e4c7b50471a354b3a9221188be90.png) [@system](https://community.openhab.org/u/system)\
**Post date:** [July 4, 2021, 2:33am UTC](https://community.openhab.org/t/help-error-13-permission-denied/122529/13 "2021-07-04T02:33:19Z")

</div>

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.
