Virtual Environment access from the network (Samba or netatalk)

I installed Home Assistant following the Virtual Environment installation steps. So I ended with a new user called homeassistant owner of the configuration files, etc.

I can login as pi and use sudo to change any file I want. But I want to access these files from my desktop (in my case from mac finder). I login as pi, but pi has no permissions to modify files in /home/homeassistant/.homeassistant.

How can I give access to user pi to modify the configuration file?

I think if you make a homeassistant or hass group or something and assign both pi and your HA user to it, then change the ownership of the files so that the group has read write rights to it you should be good. You may need to change the primary group of the HA user to the new group so that it creates files with those rights. What aggrivates me more are the log files that are always owned by root.

Thanks turboc. actually I ended doing just what you said, creating a group. Though I didn’t know how to change the HA primary group so only change the group to the configuration.yaml file and stuff I wanted to access. Thanks!

Sorry for the slight necro, but I’m trying this now - I have home assistant set up and have created a group called hass and added both pi and homeassistant users to it… but I can’t change the group for:

/home/homeassistant/.homeassistant

I did some research and I THINK it’s because homeassistant is the current folder owner, which means it needs to grant access… but it’s a catch-22, since homeassistant doesn’t have sudo privelages.

How do I give users in the group ‘hass’ write and delete access to all subdirectories in /home/hmeassistant/.homeassistant?

sudo as the pi user, elevates pi to the root user level. The root user can change any file permission or group ownership.

Yeah, tried that too! Running the following command tells me who’s in the hass group:

grep ‘hass’ /etc/group

which yields

hass:x:1001:pi,homeassistant

then, while I’m in /home/homeassistant/.homeassistant, I need to try to change the owner as sudo (logged in as pi):

sudo chgrp -R hass /home/homeassistant/.homeassistant

Well… for some reason that seemed to work. Let’s hope I haven’t royally messed up permissions, and I hope this helps anyone else in the same boat.

FYI, I wanted to do this so I could ssh into the pi from nautilus and edit the config files in my preferred text editor, atom, on linux.

If you install SAMBA on the Pi, you can edit from anywhere not just directly on the Pi.

Hmm, I’ll do that but first I’ve encountered a problem.

I tried to restart homeassistant as follows: (yes, my pi is called ultron)

sudo systemctl restart home-assistant@ultron

Unfortunately when checking the status

sudo systemctl status -l home-assistant@ultron

I get an error… I have a feeling it’s caused by the permission changes I made above. Is there any way to fix this? Any help would be GREATLY appreciated!

[email protected] - Home Assistant
Loaded: loaded (/lib/systemd/system/[email protected]; enabled)
Active: failed (Result: exit-code) since Tue 2017-04-25 17:22:28 +01; 3s ago
Process: 20472 ExecStart=/srv/homeassistant/homeassistant_venv/bin/hass -c /home/homeassistant/.homeassistant (code=exited, status=203/EXEC)
Main PID: 20472 (code=exited, status=203/EXEC)

Apr 25 17:22:28 ultron systemd[1]: Started Home Assistant.
Apr 25 17:22:28 ultron systemd[1]: [email protected]: main process exited, code=exited, status=203/EXEC
Apr 25 17:22:28 ultron systemd[1]: Unit [email protected] entered failed state.

Edit:

So it looks like it hasn’t fully failed. I think this might just be due to my most recent change [scanning network for nmap] but I really can’t be certain. Anyone able to decipher what’s going on?

The following errors have been logged this session:

17-04-25 17:16:28 WARNING (MainThread) [homeassistant.setup] Setup of device_tracker is taking over 10 seconds.
17-04-25 17:16:31 ERROR (Thread-11) [homeassistant.components.ios] Reading config file /home/homeassistant/.homeassistant/ios.conf failed: Extra data: line 1 column 1264 - line 2 column 1 (char 1263 - 1265)
17-04-25 17:16:31 ERROR (MainThread) [homeassistant.components.notify] Error setting up platform ios
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/notify/init.py”, line 101, in async_setup_platform
None, platform.get_service, hass, p_config, discovery_info)
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/notify/ios.py”, line 48, in get_service
if not ios.devices_with_push():
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/ios.py”, line 210, in devices_with_push
for device_name, device in CONFIG_FILE[ATTR_DEVICES].items():
TypeError: ‘NoneType’ object is not subscriptable
17-04-25 17:16:31 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform ios
Traceback (most recent call last):
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/helpers/entity_component.py”, line 155, in _async_setup_platform
entity_platform.schedule_add_entities, discovery_info
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/sensor/ios.py”, line 26, in setup_platform
for device_name, device in ios.devices().items():
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/ios.py”, line 228, in devices
return CONFIG_FILE[ATTR_DEVICES]
TypeError: ‘NoneType’ object is not subscriptable
17-04-25 17:16:32 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
File “/usr/lib/python3.4/asyncio/tasks.py”, line 233, in _step
result = coro.throw(exc)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/device_tracker/init.py”, line 325, in async_update_config
dev_id, device)
File “/usr/lib/python3.4/asyncio/futures.py”, line 388, in iter
yield self # This tells Task to wait for completion.
File “/usr/lib/python3.4/asyncio/tasks.py”, line 286, in _wakeup
value = future.result()
File “/usr/lib/python3.4/asyncio/futures.py”, line 277, in result
raise self._exception
File “/usr/lib/python3.4/concurrent/futures/thread.py”, line 54, in run
result = self.fn(*self.args, **self.kwargs)
File “/srv/homeassistant/lib/python3.4/site-packages/homeassistant/components/device_tracker/init.py”, line 727, in update_config
with open(path, ‘a’) as out:
PermissionError: [Errno 13] Permission denied: ‘/home/homeassistant/.homeassistant/known_devices.yaml’
17-04-25 17:16:49 ERROR (Thread-10) [homeassistant.components.switch.command_line] Command failed: nmap -p 9295 192.168.0.14 | grep -w -Eo “open”
17-04-25 17:16:53 WARNING (Thread-1) [netdisco.ssdp] Found malformed XML at http://192.168.0.19:49153/description1.xml:
17-04-25 17:16:54 WARNING (Thread-1) [netdisco.ssdp] Found malformed XML at http://192.168.0.18:49153/description0.xml:
17-04-25 17:16:54 WARNING (Thread-1) [netdisco.ssdp] Error fetching description at http://192.168.0.15:52416/devdesc.xml
17-04-25 17:16:54 WARNING (Thread-1) [netdisco.ssdp] Found malformed XML at http://192.168.0.19:49153/description2.xml:
17-04-25 17:16:54 WARNING (Thread-1) [netdisco.ssdp] Found malformed XML at http://192.168.0.19:49153/description5.xml:
17-04-25 17:16:54 WARNING (Thread-1) [netdisco.ssdp] Found malformed XML at http://192.168.0.19:49153/description3.xml:
17-04-25 17:16:54 WARNING (Thread-1) [netdisco.ssdp] Found malformed XML at http://192.168.0.18:49153/description1.xml:
17-04-25 17:17:19 ERROR (Thread-11) [homeassistant.components.switch.command_line] Command failed: nmap -p 9295 192.168.0.14 | grep -w -Eo “open”
17-04-25 17:17:50 ERROR (Thread-7) [homeassistant.components.switch.command_line] Command failed: nmap -p 9295 192.168.0.14 | grep -w -Eo “open”
17-04-25 17:18:21 ERROR (Thread-1) [homeassistant.components.switch.command_line] Command failed: nmap -p 9295 192.168.0.14 | grep -w -Eo “open”
17-04-25 17:18:52 ERROR (Thread-11) [homeassistant.components.switch.command_line] Command failed: nmap -p 9295 192.168.0.14 | grep -w -Eo “open”
17-04-25 17:19:23 ERROR (Thread-3) [homeassistant.components.switch.command_line] Command failed: nmap -p 9295 192.168.0.14 | grep -w -Eo “open”