Hello,
How can I give full access to the ‘homeassistant’ user, on the ‘/tmp/’ folder on Hassio ?
I have an error :
’ Can’t write ‘/tmp/xxxx.jpg’, no access to path! ’
I’n on Hassio v0.65.4, Raspberry pi 3.
Thank you !
Hello,
How can I give full access to the ‘homeassistant’ user, on the ‘/tmp/’ folder on Hassio ?
I have an error :
’ Can’t write ‘/tmp/xxxx.jpg’, no access to path! ’
I’n on Hassio v0.65.4, Raspberry pi 3.
Thank you !
Hi,
In order to be able to access external folders you need to explicitly whitelist them. Something like
homeassistant:
whitelist_external_dirs:
- /tmp
Here’s is the link to the homeassistant configuration parameters:
Hi,
Sorry I forgot to mention that I already mark whitelist item :
homeassistant:
name: Home
...
whitelist_external_dirs:
- /tmp
But it does not work
Hi,
Ok, in that case you might have misconfigured Unix permissions. What you can try is to make those files accessible from homeassistant
user.
You can assign ownership to homeassistant
cd /tmp
sudo chown homeassistant:homeassistant *
where homeassistant:homeassistant is user:group you want to assign the files to and * is “all files”
or you can change permissions only
cd /tmp
sudo chmod a+rw *
in this way you’ll make all files in /tmp
accessible from everyone in both reading and writing mode
For more information
Ok thank you @onegambler, if I understood correctly, this command is not to be executed on Hassio SSH, but on the Resin-OS SSH (port 22222), with the following guide : https://home-assistant.io/developers/hassio/debugging/
I’m trying this tonight
Sorry for my poor English, I’m from France.
That link you shared seems to be for debugging. You should be able to run chown
or chmod
in the normal SSH.
Have a look here:
I haven’t used it myself. I install Home-Assistant on a plain Raspbian image, so not sure how it works, but you should be able to run those commands on a normal SSH session.
This probably isn’t that simple to use /tmp
since it’s an OS directory that isn’t shared across docker containers. So the /tmp
that the Home Assistant container has is different than the /tmp
that the SSH container has, both of which are probably different than the /tmp
on the underlying resinOS.
It may be easier to just put them in one of the shared directories, e.g. /share/tmp
(you may need to create this folder in /share
first).
Usually /tmp
is world readable/writable though, so I’m not really sure why the homeassistant user wouldn’t be able to write to it or how those permissions could’ve been changed. Worth trying on a shared path though.
Worst case, try a relative path, e.g. tmp
without the leading slash, which would put it in a tmp
folder within the config directory (again you may need to create it manually first), which Home Assistant has to have access to or it wouldn’t even be able to run.
After some looking into this a bit it looks like this is coming from the camera snapshot service but the error is caused by is_allowed_path.
I tested on my setup for 0.65.5 with Hassi.io on a pi3 and was able to save snapshots to /tmp
(at least it didn’t give me an error) after adding it to the whitelist, although it’s not accessible via SSH or anything since it’s not the same /tmp
directory. I was also able to save to /share
after adding it to the whitelist and can also access the snapshots via SSH. So, not really sure what the error is. I had to do a full reboot of the pi after adding the whitelists since apparently it doesn’t fully reload the config with a restart of just HA.
Hi @tboyce1
Ok, can you give me your whitelist_external_dirs entry, and your command via the service menu ?
I have updated on 0.65.5, same problem.
My configuration.yaml :
homeassistant:
whitelist_external_dirs:
- /tmp
My service call :
{
"entity_id": "camera.dlink",
"filename": "tmp/dlink.jpg"
}
I spacify also I have created the ‘tmp’ folder in the ‘/config’ folder, via my windows 10 and samba share. Is it ok ?
Command : core-ssh:/tmp# chown -R homeassistant:homeassistant *
result :
chown: unknown user/group homeassistant:homeassistant
and command : core-ssh:/tmp# chmod -R a+rw /tmp
: should be ok.
Changing permissions on /tmp
via SSH won’t help because it’s not the same /tmp
. You’d have to SSH into resinOS via the debugging method and then from there get shell access to the Docker container running Home Assistant and then check/change the permissions within the container. It should be possible, but I’m not sure how to do it. But if you want to be able to access the saved images from outside that container, e.g. over SSH, you won’t want them in /tmp
anyway. If it’s just for sending with a notification or something, then /tmp
may be fine.
To put them in a tmp
folder within the config
directory, here is what worked for me:
homeassistant:
whitelist_external_dirs:
- /config/tmp
Then use essentially the same data
{
"entity_id": "camera.yi_home_camera_1",
"filename": "tmp/test.jpg"
}
It looks like whitelist_external_dirs
has to use absolute paths. I wasn’t able to get it working with relative paths. The camera snapshot service seems to work with either relative or absolute paths, i.e. "filename": "/config/tmp/test.jpg"
works too.
Also, I ran into an issue when trying to restart from the UI with /share
in the whitelist. So if you have /share
in there, you may need to do a full reboot to get any config changes: https://github.com/home-assistant/home-assistant/issues/13247.
Hello @tboyce1
Oh yes well done, it was my whitelist_external_dirs
wich was not good.
With absolute paths /config/tmp
, then host reboot, it’s work well.
Let’s go to make some friendly automations with my telegram bot
Thank you for your help !
Hello,
How can I give permission to tmp folder from home assistant installed on VB (windows 10)?
I have installed ssh and web terminal and can access the folder from windows.
I also have access to terminal and tried some commands but all are giving me errors