How to edit configuration.yaml via CLI?

I upgraded HA to the latest 2021.7 release that had a breaking reverse proxy-related change. Now I can’t get into HA . I got myself into this mess by not enabling SSH or Samba, so I cant easily edit the config file to fix my reverse proxy settings. However, since this is in a VM, I can access HA via CLI and see the error log with the following rows:

“Error: A request from reverse proxy was received from 192.168.1.29, but your HTTP integration is not set-up for reverse proxies”

Since I have access to CLI, is there any way to edit the config file there? If I can’t edit it, is there a way to restore the default config.yaml file?

Try changing to the config directory and running the nano text editor.

cd config
nano configuration.yaml
1 Like

Unfortunately, that does not work. it says command not found:

It may be that Home Assistant CLI is pretty limiting, so not sure if I can do anything with that.

Type login to get to a real shell.

4 Likes

Sweet - that worked! Thanks!

1 Like

Ah nutz, I thought you were already at the command prompt and not still in the initial ha command.

No worries, I think this is because I’m connecting directly via a virtual environment idk. Anyhow, got it to work, except had to use the vi command to edit the file because it said nano command was not found.

vi is superior to nano in every way, anyway :slight_smile: .

(stops watching topic)

1 Like

I can’t access my configuration.yaml file on the raspberry pi . only get the ha > prompt
if I type login , it gives me the # prompt , but can’t navigate thru directories.
Any help appreciate it.

I guess you have to study Bash commands (ls, cd, etc.) and the editor vi.

This could be a good start (don’t type the leading #):
# find . -name "configuration.yaml"

2 Likes

TLDR
Use the vi basic nix editor via ssh or command line.

I got to this thread by trying to work out why I couldn’t edit the configuration.yml file when I was trying to play around and setup Spotify.

For me, I was running an instance in docker on Windows 10.

I couldn’t find a way to edit the configuration file via the interface, and couldn’t find any way to add a file or visual editor (maybe I missed something but I can’t find a way to add any file editor add-ons).
Eventually got ssh then tried:

> yum
/bin/sh: yum: not found

> apt install nano
/bin/sh: apt: not found

> vi ./configuration.yml
(editor starts, hooray)
1 Like

Hi there,

Looks like I have a similar issue. I only have access to the command line and need to delete some YAML line that I added. When I enter > vi ./configuration.yml I don’t see any lines to edit. Am I missing a step?

Imgur

Thank you. I’m really new at this!

2 Likes

i have the same view, did you manage to solve it?

This worked for me

8 Likes