When editing my configuration.yaml
using Notepad ++ i cannot save my work im getting the error \home\homeassistant\.homeassistant\configuration.yaml failed
presumably pertaining to permissions, can someone please assist me in setting up the notepad correctly.
If you are using ubuntu or any other flavor of linux; you might want to give the user under which you are currently logged on, read and write access. You can do that by setting up an ACL
sudo setfacl -R -m u:[USER]:rwx /opt/homeassistant
Thanks for the reply i apologize but I am not familiar with ACL, how to i grant the user r/w access via putty
what platform are you using?
Windows then putty to access the pi, currently using WinSCP to edit the yaml but would like to use Notepad++ to edit my yaml, just cant figure out the permissions to be able to save using notepad i had to change the settings in WinSCP>advanced tab to use sudo -sh and that fixed the permission issue there but i dont know how to fix it in notepad
Ok, you might want to check out this video. That video is fantastic
yeah that’s what i used to get it up and running but he doesn’t go over errors while saving i even sent him a message in the comment section lol
I dont know how to edit the permission, it will let me edit the empty yaml in the pi dir but not the yaml in the homeassistant dir
Just set the default editor in winscp to be notepad++. Then when you open the file from winscp in notepad++ it will automatically transfer the permissions from winscp.
Wonderful, how do I do that? I found it thanks for the help
If you followed the video you aren’t using winscp. You are using the scp client in Notepad++. In the video it looks like he is running home assistant as the same user as he is logging is as.
Tell me a bit more about your setup.
What user is home assistant running as?
What user do you log in as with putty?
Alright thanks for the help here we go…
I flashed hassbian to SD card using etcher
Put it in my Pi
Powered it on
Launched putty ssh’d via 192.168.0.1…
Username PI
Password raspberry
In then throw the commands from this post
Get to the last command $hass it loads
Then visit the HA at the local address in chrome the front end is there with a few of my devices
I want to start editing my yaml
I DL WinSCP and configure it use the SSHPI@RASPBERRYPIADDRESS
It pulls up the root folder with 2 directories
PI
HOMEASSISTANT
I can edit my HomeAssistant configuration.yaml there but it’s my understanding notepad++ is better because it does the indenting and formatting for you so now I can’t save any edits to my yaml because I don’t have the right permissions. ( I think )
Wheww
I hope this explains my situation
Got it now. I assume you have limited linux knowledge?
First off, Raspbian doesn’t have the acl package installed when you download the image of forget the setfcal stuff for now.
*nix flavours have an easy to read file ownership and permissions list.
drwxr-xr-x 9 homeassistant homeassistant 4096 Mar 12 12:22 .
drwxr-xr-x 5 homeassistant homeassistant 4096 Mar 9 18:38 ..
drw-r--r-- 6 homeassistant homeassistant 4096 Mar 10 12:56 apdconf
drw-rw-rw- 3 homeassistant homeassistant 4096 Mar 6 16:01 backup
drwxr-xr-x 2 homeassistant homeassistant 4096 Feb 22 11:53 .cloud
drw-rw-rw- 14 homeassistant homeassistant 4096 Mar 6 15:38 config
-rw-rw-rw- 1 homeassistant homeassistant 3000 Mar 6 16:00 configuration.yaml
drw-r--r-- 2 homeassistant homeassistant 4096 Feb 22 11:50 deps
from the left:
d means its a directory (folder in windows talk), - means its a file
then we have three groups of 3 in order owner, group, everyone else
ignore the column with the numbers for now
the next two with names are the file or directory owner and group
directories must have execute permission (x) in order to read their contents.
r is read permission, w is write permission
The files I have listed are owned by user homeassistant and are in group homeassistant, they have read and write permission for owner, group and the great unwashed.
When you log in with putty you are user pi and pi hasn’t got permission to do anything in a directory owned by homeassistant
A quick fix without too many security holes will be to modify the file system permissions
type these commands:
cd /home/homeassistant/.homeassistant
ls -al
This will list the directory entries in the format above.
take note of the permission on the topmost directory (the one with the .)
it will probably be drwxr-xr-x
We need to to change that.
cd ..
sudo chmod 775 .homeassistant
that changes the permissions to give write access to the members of the group
next we add the user pi to the group homeassistant
sudo usermod -a -G homeassistant pi
to check
groups
gives a response like
pi@annabell:/home/homeassistant $ groups
pi adm dialout cdrom sudo audio video plugdev games users input netdev homeassistant gpio i2c spi
pi@annabell:/home/homeassistant $
user pi is now a member of the group homeassistant.
If you are not in the homeassistant directory. go back there
cd /home/homeassistant/.homeassistant
and see if you can create a file
touch test
ls -al
-rw-r--r-- 1 pi pi 0 Mar 12 12:59 test
This will work for you now as user pi can create and edit files. Any edited file will have its ownership changed to pi but is still world readable so hass will be happy.
If you want to make them writeable by user homeassistant you need to change the umask for the pi user.to 0002 by adding
umask 0002
to the .profile file in the pi home directory.
I use samba to share the config directory tree and use both notepad++ and Visual Studio code to edit the files.
Thanks for taking it easy on me I’m familiar with permissions from Android but am new to this world your reply was helpful, easy to understand and informative. Thank you very much!!!
For someone who’s not familiar with these types commands where would I go to learn those skills? Asking for a friend
I’m glad the above worked for you but it was WAY more complicated than I was suggesting.
You literally just had to go to the preferences in winscp and tell it use notepad++ and where to find the exe file for it. After that you just double click the file you want to edit in the winscp pane and it opens it with the proper permissions in notepad++. I’ve been doing it like that from day one.
But I’m glad you got it working.
Yeah I’m using it your way but I’m definitely interested in the reasoning behind it, so if I had to I could fix permissions in the future I’m sure it will come up somewhere down the line
Atom/Visual Studio Code + sftp/ssh extension…there is no reason to ‘download’ and have to ‘re-upload’ the changes.
The files are still being up and downloaded. You can’t edit a file that’s not on your computer with atom or VS code.
Last century, when I started with Unix, it was all RTFM and complement that with various books. These days there is a lot on the ‘net, however a lot presupposes that one has a basic understanding to start.
Check your local bookstores for anything on Unix or Linux commands.
There is a manual on your Pi. man will bring up a page.
I believe in explaining why, rather that just presenting an answer.
I believe in teaching a man to fish for himself. (I also believe in helping people who make a reasonable effort themselves and don’t want everything on a platter)