Editing config files on a linux machine

Hi,
(forgive me if this is in the wrong section)

I am giving KDE Neon a go in place of my windows machine. I used to use windows and i had samba set up so i could edit the config files.

In the file browser on linux under network i can see the samba share and i have also set up a sftp network folder to see the files. The problem is i can’t write to any of the files.

I understand the owner and group for the config files are both homeassistant so it makes sense i can’t edit the files but i don’t know how to get round this. ofcourse i also have to edit the files with sudo when using the command line editor (nano) on the pi.

I have tried out using rsub in sublime text but it’s a little unwieldy i prefer to be able to use a network folder or samba.

Thanks for any help you can give.

Even though you have stated you would like to edt the files through a network folder, the HASS Configurator might be an easy to setup alternative.

1 Like

oh cool that looks like a great idea. i will look into it. i didn’t consider it before simply because i figured a lot of people would be running linux and that it was something so easy to setup so it wasn’t put it in the docs.

Suggestion 1 would be to check the samba config for your share. I have followed @bruhautomation video a number of times and it always works flawlessly.

Suggestion 2 would be to set the file permission for your config files.

http://linuxcommand.org/lts0070.php

I am giving the setup of HASS configurator a go.

i have added the iframe panel and can see it when i login i am a little stumped as to what the correct URL to use in the configuration.yaml file. i have tried the URL of my HA setup https://xx.duckdns.org and a few others but nothing works. incidentally when i use the HA URL it just opens up another instance of the web page.

I’m going to go through the bruh video and try to fix samba but now i want to make the configurator work. it looks really cool.

Sounds like you are connecting to the machine as pi and not the homeassistant user. You can fix this in (at least) two ways:

  • Change the settings for the network share, so it connects with the homeassistant account instead of pi.

  • Change the permissions so the pi user can change the files under the HA config dir.

I went with the second options, that way I can ssh in and start editing the files, but it should work the same over a network share as the pi user.

Everything here assumes we are logged in as the user pi:

# Add user pi to the homeassistant group
sudo usermod -G homeassistant pi
# Set-group id on .homeassistant and its sub directories
find /home/homeassistant/.homeassistant -type d -exec sudo chmod --preserve-root u=rwX,g=srwX,o= {} \;
# Fix the permissions on .homeassistant and everything under
sudo chmod --preserve-root -R u=rwX,g+rwX,o= /home/homeassistant/.homeassistant
# Make a link from /home/homeassistant/.homeassistant to /home/pi/.homeassistant
ln -s /home/homeassistant/.homeassistant /home/pi/

Hi, Thanks for the reply.

Yes i was connecting as Pi.
I logged in as Pi over SSH and copy pasted your commands one at a time into the terminal. I then set up the network folder again using the path from the link created in the last command but i still can’t edit the files by opening them in sublime text from the file manager.

Hmm, that’s odd. I wonder how the network share is set up then. What is the output if you connect there with ssh and run:

ls -ld /home /home/homeassistant /home/homeassistant/.homeassistant

for me the output is:

drwxr-xr-x  4 root          root          4096 Mar  2 14:06 /home
drwxr-xr-x  6 homeassistant homeassistant 4096 Apr 13 16:04 /home/homeassistant
drwxrws--- 11 pi            homeassistant 4096 Apr 24 23:08 /home/homeassistant/.homeassistant

Well, it’s getting past midnight here, so I better be off. I don’t know what linux distribution you are running, but even so, Arch linux has excellent documentation that might of use for you even if you are running something else. Good luck!

https://wiki.archlinux.org/index.php/SSHFS
https://wiki.archlinux.org/index.php/Samba