2

The $HOME variable is incorrectly set to "/root" for all users on login on my Raspberry Pi 3B+ board running Ubuntu Server 22.04.

In an SSH session I have to manually $ export HOME=/home/ubuntu and $ source .bashrc (for the default ubuntu user, it's the same for every user I create).

However this annoyance becomes a problem with VS Code remote for example, as it can't read the profile:

stderr> -bash: /root/.bash_profile: Permission denied.

How can I load my user profiles correctly?


I've tried running usermod -d /home/ubuntu ubuntu as suggested in this answer, but everything is apparently ok (usermod: no changes).

Since I'm running the Pi headless I have no xsession as was OPs problem in the linked thread, so I'm a bit at a loss.

glaux
  • 123

1 Answers1

0

I had exactly this problem. In my case my /etc/environments file had many entries that were not supposed to be there. After comparing this file with a vanilla system, and removing the extra entries, I got my right vars back.