${HOME} Set Wrong

If none of the more specific forums is the right place to ask

${HOME} Set Wrong

Postby waldo99 » 2017-05-16 10:35

Hi,

Hoping someone can help as have spent a good few hours searching for a solution but with no luck.

On root login the HOME variable is set to ${HOME}

So when you do cd ~ it just tries to go to whatever directory you were in followed by ${HOME}

Also on login it seems to be ignoring the .profile script

Any help would be most appreciated.

Debian Version 7.11

Thanks
waldo99
 
Posts: 5
Joined: 2017-05-16 10:31

Re: ${HOME} Set Wrong

Postby roseway » 2017-05-16 10:57

I never log in as root, but if I become root from my user account then HOME is reported correctly:

eric@nuthatch:~$ echo $HOME
/home/eric
eric@nuthatch:~$ su
Password:
root@nuthatch:/home/eric# echo $HOME
/root
root@nuthatch:/home/eric# cd ~
root@nuthatch:~# pwd
/root
root@nuthatch:~#
Eric
User avatar
roseway
 
Posts: 1479
Joined: 2007-12-31 22:50
Location: Kent, UK

Re: ${HOME} Set Wrong

Postby waldo99 » 2017-05-16 12:51

It was working correctly and is on other servers I have, just it seems to of corrupted itself somehow but cannot find a way to permanently set it back to the correct path.
waldo99
 
Posts: 5
Joined: 2017-05-16 10:31

Re: ${HOME} Set Wrong

Postby debiman » 2017-05-17 05:59

please post the output of this:
Code: Select all
echo ${HOME}

as root, and as normal user.

edit:
your op sounds like you might have used single quotes around '${HOME}' somewhere...?
User avatar
debiman
 
Posts: 1519
Joined: 2013-03-12 07:18

Re: ${HOME} Set Wrong

Postby waldo99 » 2017-05-17 10:09

OK it seems to be doing it for all users, hadn't noticed on other user accounts before as I very rarely login.

As root and other users:

Code: Select all
echo ${HOME}
${HOME}

Code: Select all
env
HOME=${HOME}
waldo99
 
Posts: 5
Joined: 2017-05-16 10:31

Re: ${HOME} Set Wrong

Postby Dai_trying » 2017-05-17 11:32

You could try setting the home dir manually with
Code: Select all
usermod -d /home/whatever_dir whatever_user
as root (or with sudo)
Dai_trying
 
Posts: 332
Joined: 2016-01-07 12:25

Re: ${HOME} Set Wrong

Postby waldo99 » 2017-05-17 11:55

Tried that and get
Code: Select all
usermod: no changes


When logged in it is going to the correct home directory, just after that it has it set as ${HOME}
waldo99
 
Posts: 5
Joined: 2017-05-16 10:31

Re: ${HOME} Set Wrong

Postby Dai_trying » 2017-05-17 13:14

Then I can only think this would be relevant
debiman wrote:your op sounds like you might have used single quotes around '${HOME}' somewhere...?

some files I would check are:-
/etc/.bashrc
/etc/X11/xinit/xinitrc
/etc/profile
~/.bashrc
~/.profile
Dai_trying
 
Posts: 332
Joined: 2016-01-07 12:25

Re: ${HOME} Set Wrong

Postby waldo99 » 2017-05-17 13:48

Thanks for your suggestions as I finally found where it was set after running:

Code: Select all
grep -r '${HOME}' /etc/
/etc/security/pam_env.conf:HOME=${HOME}


I have commented out and now working.

Thanks
waldo99
 
Posts: 5
Joined: 2017-05-16 10:31

Re: ${HOME} Set Wrong

Postby reinob » 2017-05-17 17:48

waldo99 wrote:Thanks for your suggestions as I finally found where it was set after running:

Code: Select all
grep -r '${HOME}' /etc/
/etc/security/pam_env.conf:HOME=${HOME}


I have commented out and now working.

Thanks


That file is installed/owned by libpam-modules, which certainly doesn't come with that wrong line (at least mine -- sid -- is empty).

Which means ${you} have changed that for some reason.
reinob
 
Posts: 520
Joined: 2014-06-30 11:42


Return to General Questions

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable