Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Linux Newbie: How Do I Use Sudo to run this file?

Featured Replies

I've tried and I've tried to run this file, but I can't get it to work:

 

https://home-assistant.io/docs/ecosystem/hass-configurator/

Quote

 

Copy configurator.py to your Home Assistant configuration directory (e.g /home/homeassistant/.homeassistant)

Make it executable: sudo chmod 755 configurator.py

(Optional) Set the GIT variable in configurator.py to True if GitPython is installed on your system. This is required if you want to make use of the Git integration.

Execute it: sudo ./configurator.py

To terminate the process do the usual CTRL+C, maybe once or twice

 

 

When I try to do this I get:

 

root@Highlander:/mnt/user/appdata/home-assistant# sudo chmod 755 configurator.py                       
root@Highlander:/mnt/user/appdata/home-assistant# sudo ./configurator.py
sudo: unable to execute ./configurator.py: No such file or directory

What am I doing wrong?  Thanks

  • Community Expert

Are you running this inside the docker?

That script is requiring python3 (first line, #!/usr/bin/python3).  Not installed on unRAID by default and need to use the Nerd Pack to get it.  This part of a plugin or Docker?

  • Author

I'm trying to do this within putty.

 

Thanks for the python3 heads up.  I've just added this via need tools but it still doesn't work

Sudo doesn't apply with Unraid, you're already logged in as root so no need to escalate privileges with sudo.

  • Author
On 9/30/2017 at 8:48 AM, CHBMB said:

Sudo doesn't apply with Unraid, you're already logged in as root so no need to escalate privileges with sudo.

hmm still can't get it to work.  I'm parking for now

In your post above you have appdata in the directory path.  Is your HomeAssistant in a docker container?

 

If so you need to be at a bash prompt in the docker container when you type in your commands and the sudo may or may not be needed there.  So enter the following to get to a bash prompt in your container:

"docker exec -it <docker name> /bin/bash"

Edited by BobPhoenix

  • Author
11 hours ago, BobPhoenix said:

In your post above you have appdata in the directory path.  Is your HomeAssistant in a docker container?

 

If so you need to be at a bash prompt in the docker container when you type in your commands and the sudo may or may not be needed there.  So enter the following to get to a bash prompt in your container:

"docker exec -it <docker name> /bin/bash"

Not sure if I'm doing this right:

 

root@Highlander:~# docker exec -it home-assistant /bin/bash ‘configurator.py’
/bin/bash: ‘configurator.py’: No such file or directory
root@Highlander:~# docker exec -it home-assistant /bin/bash -c 'configurator.py'
/bin/bash: configurator.py: command not found
root@Highlander:~# docker exec -it home-assistant /bin/bash  'configurator.py'
/bin/bash: configurator.py: No such file or directory
root@Highlander:~# docker exec -it home-assistant /bin/bash
root@Highlander:/usr/src/app# sudo configurator.py
bash: sudo: command not found
root@Highlander:/usr/src/app# configurator.py
bash: configurator.py: command not found
root@Highlander:/usr/src/app# ./configurator.py
bash: ./configurator.py: No such file or directory
root@Highlander:/usr/src/app#

 

You first get into the docker with the "docker exec -it home-assistant /bin/bash".  Then go looking with ls command and find your configurator.py command file.  Then copy it to the correct location by looking for the path they want you to put it in.  Then setup permissions correctly.

 

SO:

root@Highlander:~# docker exec -it home-assistant /bin/bash  <-- has colored prompt for me

root@Highlander:~# <find your py file here> <-- has all WHITE prompt if in putty after connecting above (let you know if you connected correctly)

root@Highlander:~# <find your path to copy to here> <-- has all WHITE prompt blah blah blah

root@Highlander:~# cp <your py file> <path>  <-- has all WHITE prompt blah blah blah

root@Highlander:~# <set file permissions here> <-- has all WHITE prompt blah blah blah

root@Highlander:~# exit <-- has all WHITE prompt until you type exit and press enter

root@Highlander:~# <--now back to color prompt

 

If you can't find your py file it means it isn't inside your docker file space you might need to download it inside the docker or use Docker GUI in unraid to map a path to where the file IS.  Then copy it.  To download I believe you can use WGET.

Edited by BobPhoenix

  • Author

I don't think it's in the docker container - the configurator.py file is in the appdata folder.

 

I've just tried the following and it still doesn't work:

 

root@Highlander:/mnt/user/appdata/home-assistant# python ./configurator.py
  File "./configurator.py", line 1
    !/usr/bin/python
    ^
SyntaxError: invalid syntax

 

18 minutes ago, DZMM said:

I don't think it's in the docker container - the configurator.py file is in the appdata folder.

 

I've just tried the following and it still doesn't work:

 


root@Highlander:/mnt/user/appdata/home-assistant# python ./configurator.py
  File "./configurator.py", line 1
    !/usr/bin/python
    ^
SyntaxError: invalid syntax

 

Are you sure you're not missing the # as the first character in the script?

17 minutes ago, DZMM said:

I don't think it's in the docker container - the configurator.py file is in the appdata folder.

 

I've just tried the following and it still doesn't work:

 


root@Highlander:/mnt/user/appdata/home-assistant# python ./configurator.py
  File "./configurator.py", line 1
    !/usr/bin/python
    ^
SyntaxError: invalid syntax

 

 

Let's rewind this a bit.  Can you explain what you are trying to accomplish?  This script, is it part of a Docker?  If so which one?  Explain what you are trying to accomplish and the forum will be able to better help you.  What I have seen so far is you are trying to run a python script 'in the open' on unRAID.  This is bad.

  • Author

 

6 minutes ago, unevent said:

 

Let's rewind this a bit.  Can you explain what you are trying to accomplish?  This script, is it part of a Docker?  If so which one?  Explain what you are trying to accomplish and the forum will be able to better help you.  What I have seen so far is you are trying to run a python script 'in the open' on unRAID.  This is bad.

What I'm trying to achieve is in my original post - I've copied a file configurator.py to my appdata folder which is supposed to add new functionality to the home-assistant docker.  If running it is a bad idea, I'll leave it alone. 

 

Using Unraid is my only real experience of running Linux (I've worked in the internet space for nearly 20 years, but I run products & P&Ls and don't code at all for a living)  so this is all new to me.

 

 

configurator.py

32 minutes ago, DZMM said:

 

What I'm trying to achieve is in my original post - I've copied a file configurator.py to my appdata folder which is supposed to add new functionality to the home-assistant docker.  If running it is a bad idea, I'll leave it alone. 

 

Using Unraid is my only real experience of running Linux (I've worked in the internet space for nearly 20 years, but I run products & P&Ls and don't code at all for a living)  so this is all new to me.

 

 

configurator.py

 

Reading up on this script it seems it provides a web-based interface to the configuration.  Will need to know what Docker you are using to determine if you can use this script.

 

 

  • Author
Just now, unevent said:

 

Reading up on this script it seems it provides a web-based interface to the configuration.  Will need to know what Docker you are using to determine if you can use this script.

 

 

thanks for persevering!  I'm using the official docker - https://hub.docker.com/r/homeassistant/home-assistant/

You will need to be in the Docker container to execute this script.  Copy the 'configurator.py' script to your appdata config directory for the home assistant Docker.  Before moving forward, you need to use a Linux text editor to edit the script and configure for your environment.  Using 'mc' Midnight Commander on unRAID via Telnet/SSH is one way.  Telnet/SSH to unRAID and issue the command below replacing 'container_name' with the name of the container as seen on the Docker tab in unRAID GUI:

docker exec -ti container_name /bin/bash

Assuming your folder map for config is '/config', verify the existence of the configurator.py script in the config folder:

ls /config/conf*.py

After verifying/locating the file, make the script executable:

chmod +x /config/configurator.py

Execute the script:

cd /config
./configurator.py

Follow the instructions from the Hass.io site.

  • 1 year later...

@DZMM did you ever get this working?

  • Author

Nope can't remember why though

I think you should have been getting the .py file into the docker itself (not the place where configuration.yaml exists in the appdata location) by going into the console relevant to the HA docker image, then pulling the file in there with a wget, but as far as executing it, I'm stuck there.

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.