hassio-addons / addon-ssh

Advanced SSH & Web Terminal - Home Assistant Community Add-ons
https://addons.community
MIT License
338 stars 94 forks source link

When I ssh into the box I'm always root #774

Closed TheKnarf closed 1 month ago

TheKnarf commented 1 month ago

Problem/Motivation

 ssh knarf@100.99.155.91

       ▄██▄           _   _
     ▄██████▄        | | | | ___  _ __ ___   ___
   ▄████▀▀████▄      | |_| |/ _ \| '_ ` _ \ / _ \
 ▄█████    █████▄    |  _  | (_) | | | | | |  __/
▄██████▄  ▄██████▄   |_| |_|\___/|_| |_| |_|\___|          _
████████  ██▀  ▀██      / \   ___ ___(_)___| |_ __ _ _ __ | |_
███▀▀███  ██   ▄██     / _ \ / __/ __| / __| __/ _` | '_ \| __|
██    ██  ▀ ▄█████    / ___ \\__ \__ \ \__ \ || (_| | | | | |_
███▄▄ ▀█  ▄███████   /_/   \_\___/___/_|___/\__\__,_|_| |_|\__|
▀█████▄   ███████▀

Welcome to the Home Assistant command line.

System information
  IPv4 addresses for end0:  192.168.1.102/24

  OS Version:               Home Assistant OS 12.4
  Home Assistant Core:      2024.8.1

  Home Assistant URL:       http://homeassistant.local:8123
  Observer URL:             http://homeassistant.local:4357
~ # echo $USER
root

When I ssh into my HomeAssistant Yellow that has the Advanced SSH & Web Terminal installed, I always become the root user instead of the user I tried to ssh as.

Expected behavior

For SSH to work normally. It should sign me in as the user I'm trying to sign in as.

Actual behavior

No matter what the USER env variable on the host, nor what parameters is sent to SSH, I always gets signed in as root instead.

Steps to reproduce

Proposed changes

Maybe fix your plugin? Either that or I nuke Home Assistant from the box and install Raspberry PI OS instead. If you can't behave then I don't trust you running on my device.

frenck commented 1 month ago

I always become the root user instead of the user I tried to ssh as.

Correct.

No matter what the USER env variable on the host, nor what parameters is sent to SSH, I always gets signed in as root instead.

Correct.

Maybe fix your plugin?

If you can't behave then I don't trust you running on my device.

Nothing to fix. You are in a container; thus an isolated environment already. This is not host system root...

Either that or I nuke Home Assistant from the box and install Raspberry PI OS instead.

Sound like a plan. Not sure what you want to achieve with comment, but have fun doing that 👍

../Frenck

TheKnarf commented 1 month ago

Nothing to fix. You are in a container; thus an isolated environment already. This is not host system root...

Okay, that makes sense. But I don't think this was ever documented? At no point in the description of the addon does it say that this is a container and not the host system.

If not this plugin, then how am I supposed to get SSH access to the host OS?

frenck commented 1 month ago

At no point in the description of the addon does it say that this is a container and not the host system.

All add-ons are. It sounds to me like you are familiar with Home Assistant and blame this documentation/add-on for it.

If not this plugin, then how am I supposed to get SSH access to the host OS?

You don't. There is no need to either, as it is a read-only filesystem (it is a firmware in that regard).

TheKnarf commented 1 month ago

All add-ons are. It sounds to me like you are familiar with Home Assistant and blame this documentation/add-on for it.

I think the description of this plugin specifically should mention it. Anyone new to Home Assistant OS would assume that this plugin gives them SSH to the host system, the fact that its an isolated container should be mentioned somewhere... It seems like thats would be an important detail.

You don't. There is no need to either, as it is a read-only filesystem (it is a firmware in that regard).

Thats not something anyone new to Home Assistant OS would know. I would imagine that most people that install this plugin do so because they know Linux and SSH, and probably want more control over the host OS.