OpenWrt Forum Archive

Topic: why is "export HOME=/tmp" in /etc/profile?

The content of this topic has been archived on 31 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

hi,
I'm wondering why the line "export HOME=/tmp" is in /etc/profile. I tried to add a new user, but ran into the problem that e.g. weechat wouldnt work, "cd" always got me into the wrong dir etc...
so after some searching I found the culprit in /etc/profile..

so.. why exactly is that there?
1. it works perfectly without that line (HOME still defined if i run env as root)
2. it breaks adding new users

bug or feature?

Should work in trunk.

balou wrote:

so.. why exactly is that there?
1. it works perfectly without that line (HOME still defined if i run env as root)
2. it breaks adding new users

bug or feature?

I'd call it a bug, but that's just my opinion. Well, it's an opinion that's shared with virtually every other shell I could find... they all assume HOME is already set by the "login" program. OpenWRT seems to assume that "root" will be the only interactive user, the only user who needs a writable HOME directory, and in most installations, /tmp is the only reasonable choice.

Personally, if/when I add more users to an OpenWRT installation, I'll remove that line from /etc/profile - I really can't see a reason for it - root's home directory is set as /tmp in /etc/passwd, which is exactly where everyone's HOME is set.

The discussion might have continued from here.