Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

${HOME} Set Wrong

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
waldo99
Posts: 5
Joined: 2017-05-16 10:31

${HOME} Set Wrong

#1 Post by waldo99 »

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

User avatar
roseway
Posts: 1528
Joined: 2007-12-31 22:50
Location: Kent, UK
Has thanked: 3 times
Been thanked: 4 times

Re: ${HOME} Set Wrong

#2 Post by roseway »

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

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

Re: ${HOME} Set Wrong

#3 Post by waldo99 »

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.

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: ${HOME} Set Wrong

#4 Post by debiman »

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...?

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

Re: ${HOME} Set Wrong

#5 Post by waldo99 »

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}

Dai_trying
Posts: 1100
Joined: 2016-01-07 12:25
Has thanked: 5 times
Been thanked: 16 times

Re: ${HOME} Set Wrong

#6 Post by Dai_trying »

You could try setting the home dir manually with

Code: Select all

usermod -d /home/whatever_dir whatever_user
as root (or with sudo)

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

Re: ${HOME} Set Wrong

#7 Post by waldo99 »

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}

Dai_trying
Posts: 1100
Joined: 2016-01-07 12:25
Has thanked: 5 times
Been thanked: 16 times

Re: ${HOME} Set Wrong

#8 Post by Dai_trying »

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

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

Re: ${HOME} Set Wrong

#9 Post by waldo99 »

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

reinob
Posts: 1189
Joined: 2014-06-30 11:42
Has thanked: 97 times
Been thanked: 47 times

Re: ${HOME} Set Wrong

#10 Post by reinob »

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.

Post Reply